Back to index

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

List of all members.

Public Member Functions

def test_detect_file
def test_detect_fileobj

Private Member Functions

def _testfunc_file
def _testfunc_fileobj
def _test_modes

Detailed Description

Definition at line 476 of file test_tarfile.py.


Member Function Documentation

def test.test_tarfile.DetectReadTest._test_modes (   self,
  testfunc 
) [private]

Definition at line 495 of file test_tarfile.py.

00495 
00496     def _test_modes(self, testfunc):
00497         testfunc(tarname, "r")
00498         testfunc(tarname, "r:")
00499         testfunc(tarname, "r:*")
00500         testfunc(tarname, "r|")
00501         testfunc(tarname, "r|*")
00502 
00503         if gzip:
00504             self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r:gz")
00505             self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r|gz")
00506             self.assertRaises(tarfile.ReadError, tarfile.open, gzipname, mode="r:")
00507             self.assertRaises(tarfile.ReadError, tarfile.open, gzipname, mode="r|")
00508 
00509             testfunc(gzipname, "r")
00510             testfunc(gzipname, "r:*")
00511             testfunc(gzipname, "r:gz")
00512             testfunc(gzipname, "r|*")
00513             testfunc(gzipname, "r|gz")
00514 
00515         if bz2:
00516             self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r:bz2")
00517             self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r|bz2")
00518             self.assertRaises(tarfile.ReadError, tarfile.open, bz2name, mode="r:")
00519             self.assertRaises(tarfile.ReadError, tarfile.open, bz2name, mode="r|")
00520 
00521             testfunc(bz2name, "r")
00522             testfunc(bz2name, "r:*")
00523             testfunc(bz2name, "r:bz2")
00524             testfunc(bz2name, "r|*")
00525             testfunc(bz2name, "r|bz2")

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_tarfile.DetectReadTest._testfunc_file (   self,
  name,
  mode 
) [private]

Definition at line 478 of file test_tarfile.py.

00478 
00479     def _testfunc_file(self, name, mode):
00480         try:
00481             tar = tarfile.open(name, mode)
00482         except tarfile.ReadError as e:
00483             self.fail()
00484         else:
00485             tar.close()

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_tarfile.DetectReadTest._testfunc_fileobj (   self,
  name,
  mode 
) [private]

Definition at line 486 of file test_tarfile.py.

00486 
00487     def _testfunc_fileobj(self, name, mode):
00488         try:
00489             with open(name, "rb") as f:
00490                 tar = tarfile.open(name, mode, fileobj=f)
00491         except tarfile.ReadError as e:
00492             self.fail()
00493         else:
00494             tar.close()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 526 of file test_tarfile.py.

00526 
00527     def test_detect_file(self):
00528         self._test_modes(self._testfunc_file)

Here is the call graph for this function:

Definition at line 529 of file test_tarfile.py.

00529 
00530     def test_detect_fileobj(self):
00531         self._test_modes(self._testfunc_fileobj)
00532 

Here is the call graph for this function:


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