Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions
test.test_tarfile.GNUWriteTest Class Reference
Inheritance diagram for test.test_tarfile.GNUWriteTest:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def test_longname_1023
def test_longname_1024
def test_longname_1025
def test_longlink_1023
def test_longlink_1024
def test_longlink_1025
def test_longnamelink_1023
def test_longnamelink_1024
def test_longnamelink_1025

Private Member Functions

def _length
def _calc_size
def _test

Detailed Description

Definition at line 1105 of file test_tarfile.py.


Member Function Documentation

def test.test_tarfile.GNUWriteTest._calc_size (   self,
  name,
  link = None 
) [private]

Definition at line 1115 of file test_tarfile.py.

01115 
01116     def _calc_size(self, name, link=None):
01117         # Initial tar header
01118         count = 512
01119 
01120         if len(name) > tarfile.LENGTH_NAME:
01121             # GNU longname extended header + longname
01122             count += 512
01123             count += self._length(name)
01124         if link is not None and len(link) > tarfile.LENGTH_LINK:
01125             # GNU longlink extended header + longlink
01126             count += 512
01127             count += self._length(link)
01128         return count

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_tarfile.GNUWriteTest._length (   self,
  s 
) [private]

Definition at line 1109 of file test_tarfile.py.

01109 
01110     def _length(self, s):
01111         blocks, remainder = divmod(len(s) + 1, 512)
01112         if remainder:
01113             blocks += 1
01114         return blocks * 512

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_tarfile.GNUWriteTest._test (   self,
  name,
  link = None 
) [private]

Reimplemented in test.test_tarfile.PaxWriteTest.

Definition at line 1129 of file test_tarfile.py.

01129 
01130     def _test(self, name, link=None):
01131         tarinfo = tarfile.TarInfo(name)
01132         if link:
01133             tarinfo.linkname = link
01134             tarinfo.type = tarfile.LNKTYPE
01135 
01136         tar = tarfile.open(tmpname, "w")
01137         try:
01138             tar.format = tarfile.GNU_FORMAT
01139             tar.addfile(tarinfo)
01140 
01141             v1 = self._calc_size(name, link)
01142             v2 = tar.offset
01143             self.assertTrue(v1 == v2, "GNU longname/longlink creation failed")
01144         finally:
01145             tar.close()
01146 
01147         tar = tarfile.open(tmpname)
01148         try:
01149             member = tar.next()
01150             self.assertIsNotNone(member,
01151                     "unable to read longname member")
01152             self.assertEqual(tarinfo.name, member.name,
01153                     "unable to read longname member")
01154             self.assertEqual(tarinfo.linkname, member.linkname,
01155                     "unable to read longname member")
01156         finally:
01157             tar.close()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1167 of file test_tarfile.py.

01167 
01168     def test_longlink_1023(self):
01169         self._test("name", ("longlnk/" * 127) + "longlnk")

Here is the call graph for this function:

Definition at line 1170 of file test_tarfile.py.

01170 
01171     def test_longlink_1024(self):
01172         self._test("name", ("longlnk/" * 127) + "longlink")

Here is the call graph for this function:

Definition at line 1173 of file test_tarfile.py.

01173 
01174     def test_longlink_1025(self):
01175         self._test("name", ("longlnk/" * 127) + "longlink_")

Here is the call graph for this function:

Definition at line 1158 of file test_tarfile.py.

01158 
01159     def test_longname_1023(self):
01160         self._test(("longnam/" * 127) + "longnam")

Here is the call graph for this function:

Definition at line 1161 of file test_tarfile.py.

01161 
01162     def test_longname_1024(self):
01163         self._test(("longnam/" * 127) + "longname")

Here is the call graph for this function:

Definition at line 1164 of file test_tarfile.py.

01164 
01165     def test_longname_1025(self):
01166         self._test(("longnam/" * 127) + "longname_")

Here is the call graph for this function:

Definition at line 1176 of file test_tarfile.py.

01176 
01177     def test_longnamelink_1023(self):
01178         self._test(("longnam/" * 127) + "longnam",
01179                    ("longlnk/" * 127) + "longlnk")

Here is the call graph for this function:

Definition at line 1180 of file test_tarfile.py.

01180 
01181     def test_longnamelink_1024(self):
01182         self._test(("longnam/" * 127) + "longname",
01183                    ("longlnk/" * 127) + "longlink")

Here is the call graph for this function:

Definition at line 1184 of file test_tarfile.py.

01184 
01185     def test_longnamelink_1025(self):
01186         self._test(("longnam/" * 127) + "longname_",
01187                    ("longlnk/" * 127) + "longlink_")
01188 

Here is the call graph for this function:


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