Back to index

python3.2  3.2.2
Private Member Functions
test.test_mailbox.TestProxyFileBase Class Reference
Inheritance diagram for test.test_mailbox.TestProxyFileBase:
Inheritance graph
[legend]
Collaboration diagram for test.test_mailbox.TestProxyFileBase:
Collaboration graph
[legend]

List of all members.

Private Member Functions

def _test_read
def _test_readline
def _test_readlines
def _test_iteration
def _test_seek_and_tell
def _test_close

Detailed Description

Definition at line 1797 of file test_mailbox.py.


Member Function Documentation

def test.test_mailbox.TestProxyFileBase._test_close (   self,
  proxy 
) [private]

Definition at line 1870 of file test_mailbox.py.

01870 
01871     def _test_close(self, proxy):
01872         # Close a file
01873         self.assertFalse(proxy.closed)
01874         proxy.close()
01875         self.assertTrue(proxy.closed)
01876         # Issue 11700 subsequent closes should be a no-op.
01877         proxy.close()
01878         self.assertTrue(proxy.closed)
01879 

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_mailbox.TestProxyFileBase._test_iteration (   self,
  proxy 
) [private]

Definition at line 1844 of file test_mailbox.py.

01844 
01845     def _test_iteration(self, proxy):
01846         # Iterate by line
01847         linesep = os.linesep.encode()
01848         proxy.seek(0)
01849         iterator = iter(proxy)
01850         self.assertEqual(next(iterator), b'foo' + linesep)
01851         self.assertEqual(next(iterator), b'bar' + linesep)
01852         self.assertEqual(next(iterator), b'fred' + linesep)
01853         self.assertEqual(next(iterator), b'bob')
01854         self.assertRaises(StopIteration, next, iterator)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_mailbox.TestProxyFileBase._test_read (   self,
  proxy 
) [private]

Definition at line 1799 of file test_mailbox.py.

01799 
01800     def _test_read(self, proxy):
01801         # Read by byte
01802         proxy.seek(0)
01803         self.assertEqual(proxy.read(), b'bar')
01804         proxy.seek(1)
01805         self.assertEqual(proxy.read(), b'ar')
01806         proxy.seek(0)
01807         self.assertEqual(proxy.read(2), b'ba')
01808         proxy.seek(1)
01809         self.assertEqual(proxy.read(-1), b'ar')
01810         proxy.seek(2)
01811         self.assertEqual(proxy.read(1000), b'r')

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_mailbox.TestProxyFileBase._test_readline (   self,
  proxy 
) [private]

Definition at line 1812 of file test_mailbox.py.

01812 
01813     def _test_readline(self, proxy):
01814         # Read by line
01815         linesep = os.linesep.encode()
01816         proxy.seek(0)
01817         self.assertEqual(proxy.readline(), b'foo' + linesep)
01818         self.assertEqual(proxy.readline(), b'bar' + linesep)
01819         self.assertEqual(proxy.readline(), b'fred' + linesep)
01820         self.assertEqual(proxy.readline(), b'bob')
01821         proxy.seek(2)
01822         self.assertEqual(proxy.readline(), b'o' + linesep)
01823         proxy.seek(6 + 2 * len(os.linesep))
01824         self.assertEqual(proxy.readline(), b'fred' + linesep)
01825         proxy.seek(6 + 2 * len(os.linesep))
01826         self.assertEqual(proxy.readline(2), b'fr')
01827         self.assertEqual(proxy.readline(-10), b'ed' + linesep)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_mailbox.TestProxyFileBase._test_readlines (   self,
  proxy 
) [private]

Definition at line 1828 of file test_mailbox.py.

01828 
01829     def _test_readlines(self, proxy):
01830         # Read multiple lines
01831         linesep = os.linesep.encode()
01832         proxy.seek(0)
01833         self.assertEqual(proxy.readlines(), [b'foo' + linesep,
01834                                            b'bar' + linesep,
01835                                            b'fred' + linesep, b'bob'])
01836         proxy.seek(0)
01837         self.assertEqual(proxy.readlines(2), [b'foo' + linesep])
01838         proxy.seek(3 + len(linesep))
01839         self.assertEqual(proxy.readlines(4 + len(linesep)),
01840                      [b'bar' + linesep, b'fred' + linesep])
01841         proxy.seek(3)
01842         self.assertEqual(proxy.readlines(1000), [linesep, b'bar' + linesep,
01843                                                b'fred' + linesep, b'bob'])

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_mailbox.TestProxyFileBase._test_seek_and_tell (   self,
  proxy 
) [private]

Definition at line 1855 of file test_mailbox.py.

01855 
01856     def _test_seek_and_tell(self, proxy):
01857         # Seek and use tell to check position
01858         linesep = os.linesep.encode()
01859         proxy.seek(3)
01860         self.assertEqual(proxy.tell(), 3)
01861         self.assertEqual(proxy.read(len(linesep)), linesep)
01862         proxy.seek(2, 1)
01863         self.assertEqual(proxy.read(1 + len(linesep)), b'r' + linesep)
01864         proxy.seek(-3 - len(linesep), 2)
01865         self.assertEqual(proxy.read(3), b'bar')
01866         proxy.seek(2, 0)
01867         self.assertEqual(proxy.read(), b'o' + linesep + b'bar' + linesep)
01868         proxy.seek(100)
01869         self.assertFalse(proxy.read())

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: