本文整理匯總了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)
示例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))
示例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)))
示例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)))
示例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)))
示例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).
示例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)
示例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))
示例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)))
示例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)))
示例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)))
示例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).