Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_tarfile.LongnameTest Class Reference
Inheritance diagram for test.test_tarfile.LongnameTest:
Inheritance graph
[legend]
Collaboration diagram for test.test_tarfile.LongnameTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_read_longname
def test_read_longlink
def test_truncated_longname
def test_header_offset
def setUp
def tearDown

Public Attributes

 tar

Static Public Attributes

 tarname = tarname
string mode = "r:"

Detailed Description

Definition at line 626 of file test_tarfile.py.


Member Function Documentation

def test.test_tarfile.ReadTest.setUp (   self) [inherited]

Definition at line 43 of file test_tarfile.py.

00043 
00044     def setUp(self):
00045         self.tar = tarfile.open(self.tarname, mode=self.mode, encoding="iso8859-1")

Here is the caller graph for this function:

def test.test_tarfile.ReadTest.tearDown (   self) [inherited]

Definition at line 46 of file test_tarfile.py.

00046 
00047     def tearDown(self):
00048         self.tar.close()
00049 

Here is the caller graph for this function:

Definition at line 654 of file test_tarfile.py.

00654 
00655     def test_header_offset(self):
00656         # Test if the start offset of the TarInfo object includes
00657         # the preceding extended header.
00658         longname = self.subdir + "/" + "123/" * 125 + "longname"
00659         offset = self.tar.getmember(longname).offset
00660         with open(tarname, "rb") as fobj:
00661             fobj.seek(offset)
00662             tarinfo = tarfile.TarInfo.frombuf(fobj.read(512), "iso8859-1", "strict")
00663             self.assertEqual(tarinfo.type, self.longnametype)
00664 

Here is the call graph for this function:

Definition at line 637 of file test_tarfile.py.

00637 
00638     def test_read_longlink(self):
00639         longname = self.subdir + "/" + "123/" * 125 + "longname"
00640         longlink = self.subdir + "/" + "123/" * 125 + "longlink"
00641         try:
00642             tarinfo = self.tar.getmember(longlink)
00643         except KeyError:
00644             self.fail("longlink not found")
00645         self.assertTrue(tarinfo.linkname == longname, "linkname wrong")

Here is the call graph for this function:

Definition at line 628 of file test_tarfile.py.

00628 
00629     def test_read_longname(self):
00630         # Test reading of longname (bug #1471427).
00631         longname = self.subdir + "/" + "123/" * 125 + "longname"
00632         try:
00633             tarinfo = self.tar.getmember(longname)
00634         except KeyError:
00635             self.fail("longname not found")
00636         self.assertTrue(tarinfo.type != tarfile.DIRTYPE, "read longname as dirtype")

Here is the call graph for this function:

Definition at line 646 of file test_tarfile.py.

00646 
00647     def test_truncated_longname(self):
00648         longname = self.subdir + "/" + "123/" * 125 + "longname"
00649         tarinfo = self.tar.getmember(longname)
00650         offset = tarinfo.offset
00651         self.tar.fileobj.seek(offset)
00652         fobj = io.BytesIO(self.tar.fileobj.read(3 * 512))
00653         self.assertRaises(tarfile.ReadError, tarfile.open, name="foo.tar", fileobj=fobj)

Here is the call graph for this function:


Member Data Documentation

string test.test_tarfile.ReadTest.mode = "r:" [static, inherited]

Reimplemented in test.test_tarfile.MemberReadTest.

Definition at line 44 of file test_tarfile.py.


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