Exemple #1
0
 def test_is_archive_rar_split(self):
     self.assertTrue(Extract.is_archive(TestExtract.ar_rar_split_p1))
     self.assertTrue(Extract.is_archive(TestExtract.ar_rar_split_p2))
Exemple #2
0
 def test_is_archive_tar_gz(self):
     self.assertTrue(Extract.is_archive(TestExtract.ar_tar_gz))
Exemple #3
0
 def test_is_archive_rar(self):
     self.assertTrue(Extract.is_archive(TestExtract.ar_rar))
Exemple #4
0
 def test_is_archive_zip(self):
     self.assertTrue(Extract.is_archive(TestExtract.ar_zip))
Exemple #5
0
 def test_is_archive_false_on_bad_archive(self):
     path = os.path.join(TestExtract.temp_dir, "bad_file")
     with open(path, 'wb') as f:
         f.write(bytearray(os.urandom(100)))
     self.assertTrue(os.path.isfile(path))
     self.assertFalse(Extract.is_archive(path))
Exemple #6
0
 def test_is_archive_false_on_dir(self):
     path = os.path.join(TestExtract.temp_dir, "dir")
     os.mkdir(path)
     self.assertTrue(os.path.isdir(path))
     self.assertFalse(Extract.is_archive(path))
Exemple #7
0
 def test_is_archive_false_on_nonexisting_file(self):
     self.assertFalse(
         Extract.is_archive(os.path.join(TestExtract.temp_dir, "no_file")))