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))
def test_is_archive_tar_gz(self): self.assertTrue(Extract.is_archive(TestExtract.ar_tar_gz))
def test_is_archive_rar(self): self.assertTrue(Extract.is_archive(TestExtract.ar_rar))
def test_is_archive_zip(self): self.assertTrue(Extract.is_archive(TestExtract.ar_zip))
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))
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))
def test_is_archive_false_on_nonexisting_file(self): self.assertFalse( Extract.is_archive(os.path.join(TestExtract.temp_dir, "no_file")))