當前位置: 首頁>>代碼示例>>Python>>正文


Python mailbox._PartialFile方法代碼示例

本文整理匯總了Python中mailbox._PartialFile方法的典型用法代碼示例。如果您正苦於以下問題:Python mailbox._PartialFile方法的具體用法?Python mailbox._PartialFile怎麽用?Python mailbox._PartialFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mailbox的用法示例。


在下文中一共展示了mailbox._PartialFile方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_initialize

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_initialize(self):
        # Initialize and check position
        self._file.write('foo' + os.linesep + 'bar')
        pos = self._file.tell()
        proxy = mailbox._PartialFile(self._file, 2, 5)
        self.assertEqual(proxy.tell(), 0)
        self.assertEqual(self._file.tell(), pos) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:test_mailbox.py

示例2: test_read

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_read(self):
        self._file.write('***bar***')
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:5,代碼來源:test_mailbox.py

示例3: test_readline

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_readline(self):
        self._file.write('!!!!!foo%sbar%sfred%sbob!!!!!' %
                         (os.linesep, os.linesep, os.linesep))
        self._test_readline(mailbox._PartialFile(self._file, 5,
                                                 18 + 3 * len(os.linesep))) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:test_mailbox.py

示例4: test_readlines

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_readlines(self):
        self._file.write('foo%sbar%sfred%sbob?????' %
                         (os.linesep, os.linesep, os.linesep))
        self._test_readlines(mailbox._PartialFile(self._file, 0,
                                                  13 + 3 * len(os.linesep))) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:test_mailbox.py

示例5: test_iteration

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_iteration(self):
        self._file.write('____foo%sbar%sfred%sbob####' %
                         (os.linesep, os.linesep, os.linesep))
        self._test_iteration(mailbox._PartialFile(self._file, 4,
                                                  17 + 3 * len(os.linesep))) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:test_mailbox.py

示例6: test_close

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_close(self):
        self._file.write('&foo%sbar%s^' % (os.linesep, os.linesep))
        self._test_close(mailbox._PartialFile(self._file, 1,
                                              6 + 3 * len(os.linesep)))


## Start: tests from the original module (for backward compatibility). 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:test_mailbox.py

示例7: test_initialize

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_initialize(self):
        # Initialize and check position
        self._file.write(bytes('foo' + os.linesep + 'bar', 'ascii'))
        pos = self._file.tell()
        proxy = mailbox._PartialFile(self._file, 2, 5)
        self.assertEqual(proxy.tell(), 0)
        self.assertEqual(self._file.tell(), pos) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:9,代碼來源:test_mailbox.py

示例8: test_read

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_read(self):
        self._file.write(bytes('***bar***', 'ascii'))
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:5,代碼來源:test_mailbox.py

示例9: test_readline

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_readline(self):
        self._file.write(bytes('!!!!!foo%sbar%sfred%sbob!!!!!' %
                         (os.linesep, os.linesep, os.linesep), 'ascii'))
        self._test_readline(mailbox._PartialFile(self._file, 5,
                                                 18 + 3 * len(os.linesep))) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:7,代碼來源:test_mailbox.py

示例10: test_readlines

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_readlines(self):
        self._file.write(bytes('foo%sbar%sfred%sbob?????' %
                         (os.linesep, os.linesep, os.linesep), 'ascii'))
        self._test_readlines(mailbox._PartialFile(self._file, 0,
                                                  13 + 3 * len(os.linesep))) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:7,代碼來源:test_mailbox.py

示例11: test_iteration

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_iteration(self):
        self._file.write(bytes('____foo%sbar%sfred%sbob####' %
                         (os.linesep, os.linesep, os.linesep), 'ascii'))
        self._test_iteration(mailbox._PartialFile(self._file, 4,
                                                  17 + 3 * len(os.linesep))) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:7,代碼來源:test_mailbox.py

示例12: test_close

# 需要導入模塊: import mailbox [as 別名]
# 或者: from mailbox import _PartialFile [as 別名]
def test_close(self):
        self._file.write(bytes('&foo%sbar%s^' % (os.linesep, os.linesep), 'ascii'))
        self._test_close(mailbox._PartialFile(self._file, 1,
                                              6 + 3 * len(os.linesep)))


## Start: tests from the original module (for backward compatibility). 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:9,代碼來源:test_mailbox.py


注:本文中的mailbox._PartialFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。