Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
test.test_tarfile.Bz2PartialReadTest Class Reference

List of all members.

Public Member Functions

def test_partial_input
def test_partial_input_bz2

Public Attributes

 hit_eof

Private Member Functions

def _test_partial_input

Detailed Description

Definition at line 1719 of file test_tarfile.py.


Member Function Documentation

def test.test_tarfile.Bz2PartialReadTest._test_partial_input (   self,
  mode 
) [private]

Definition at line 1723 of file test_tarfile.py.

01723 
01724     def _test_partial_input(self, mode):
01725         class MyBytesIO(io.BytesIO):
01726             hit_eof = False
01727             def read(self, n):
01728                 if self.hit_eof:
01729                     raise AssertionError("infinite loop detected in tarfile.open()")
01730                 self.hit_eof = self.tell() == len(self.getvalue())
01731                 return super(MyBytesIO, self).read(n)
01732             def seek(self, *args):
01733                 self.hit_eof = False
01734                 return super(MyBytesIO, self).seek(*args)
01735 
01736         data = bz2.compress(tarfile.TarInfo("foo").tobuf())
01737         for x in range(len(data) + 1):
01738             try:
01739                 tarfile.open(fileobj=MyBytesIO(data[:x]), mode=mode)
01740             except tarfile.ReadError:
01741                 pass # we have no interest in ReadErrors

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1742 of file test_tarfile.py.

01742 
01743     def test_partial_input(self):
01744         self._test_partial_input("r")

Here is the call graph for this function:

Definition at line 1745 of file test_tarfile.py.

01745 
01746     def test_partial_input_bz2(self):
01747         self._test_partial_input("r:bz2")
01748 

Here is the call graph for this function:


Member Data Documentation

Definition at line 1729 of file test_tarfile.py.


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