Python mailbox._PartialFile() Examples

The following are 30 code examples of mailbox._PartialFile(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module mailbox , or try the search function .
Example #1
Source File: test_mailbox.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
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))) 
Example #2
Source File: test_mailbox.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_read(self):
        self._file.write('***bar***')
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
Example #3
Source File: test_mailbox.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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))) 
Example #4
Source File: test_mailbox.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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))) 
Example #5
Source File: test_mailbox.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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))) 
Example #6
Source File: test_mailbox.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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). 
Example #7
Source File: test_mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #8
Source File: test_mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_read(self):
        self._file.write(bytes('***bar***', 'ascii'))
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
Example #9
Source File: test_mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #10
Source File: test_mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #11
Source File: test_mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #12
Source File: test_mailbox.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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). 
Example #13
Source File: test_mailbox.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
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.assert_(proxy.tell() == 0)
        self.assert_(self._file.tell() == pos) 
Example #14
Source File: test_mailbox.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_read(self):
        self._file.write('***bar***')
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
Example #15
Source File: test_mailbox.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
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))) 
Example #16
Source File: test_mailbox.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #17
Source File: test_mailbox.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
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))) 
Example #18
Source File: test_mailbox.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
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). 
Example #19
Source File: test_mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #20
Source File: test_mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_read(self):
        self._file.write('***bar***')
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
Example #21
Source File: test_mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #22
Source File: test_mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #23
Source File: test_mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #24
Source File: test_mailbox.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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). 
Example #25
Source File: test_mailbox.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #26
Source File: test_mailbox.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_read(self):
        self._file.write('***bar***')
        self._test_read(mailbox._PartialFile(self._file, 3, 6)) 
Example #27
Source File: test_mailbox.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #28
Source File: test_mailbox.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #29
Source File: test_mailbox.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #30
Source File: test_mailbox.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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).