本文整理汇总了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).