def test_noace_plain(): assert "ACE archive" in f("ace_plain.ace").magic t = AceFile(f("ace_plain.ace")) assert t.handles() is True with pytest.raises(UnpackException): t.unpack()
def test_garbage(self): t = AceFile(f("garbage.bin")) assert t.handles() is False assert not t.f.selected with pytest.raises(UnpackException) as e: t.unpack() assert e.value.state == Errors.NOTHING_EXTRACTED
def test_ace_plain(self): assert "ACE archive" in f("ace_plain.ace").magic t = AceFile(f("ace_plain.ace")) assert t.handles() is True assert not t.f.selected files = list(t.unpack()) assert len(files) == 1 assert files[0].relapath == "ace.txt" assert files[0].contents == "wow .ace" assert "ASCII text" in files[0].magic assert files[0].parentdirs == [] assert not files[0].selected
def test_nested2_plain(self): assert "ACE archive" in f("ace_nested2.ace").magic t = AceFile(f("ace_nested2.ace")) assert t.handles() is True assert not t.f.selected files = list(t.unpack()) assert len(files) == 1 assert files[0].relapath == "derp/b00/ace.txt" assert files[0].parentdirs == ["derp", "b00"] assert files[0].contents == b"wow .ace" assert not files[0].password assert "ASCII text" in files[0].magic assert not files[0].selected
def test_nested2_plain(self): assert "ACE archive" in f("ace_nested2.ace").magic t = AceFile(f("ace_nested2.ace")) assert t.handles() is True files = list(t.unpack()) assert len(files) == 1 assert files[0].filepath == "derp/b00/ace.txt" assert files[0].parentdirs == ["derp", "b00"] assert files[0].contents == "wow .ace" assert not files[0].password assert "ASCII text" in files[0].magic s = f("ace_nested2.ace").get_signature() assert s is None
def test_ace_plain(self): assert "ACE archive" in f("ace_plain.ace").magic t = AceFile(f("ace_plain.ace")) assert t.handles() is True files = list(t.unpack()) assert len(files) == 1 assert files[0].filepath == "ace.txt" assert files[0].contents == "wow .ace" assert "ASCII text" in files[0].magic assert files[0].parentdirs == [] # TODO A combination of file extension, file magic, and initial bytes # signature should be used instead of just the bytes (as this call # should not yield None). assert f("ace_plain.ace").get_signature() is None
def test_count_supported(): count = 15 if AceFile(None).supported(): count += 1 if CabFile(None).supported(): count += 1 if RarFile(None).supported(): count += 1 if Zip7File(None).supported(): count += 7 assert count == len(supported())
def test_count_supported(): count = 10 if DaaFile(None).supported(): count += 1 if VHDFile(None).supported(): count += 2 if AceFile(None).supported(): count += 1 if CabFile(None).supported(): count += 1 if RarFile(None).supported(): count += 1 if Zip7File(None).supported(): count += 5 assert count == len(supported())
def test_noace_plain(): assert "ACE archive" in f("ace_plain.ace").magic t = AceFile(f("ace_plain.ace")) assert t.handles() is True assert not t.f.selected
def test_garbage(self): t = AceFile(f("garbage.bin")) assert t.handles() is False assert not t.f.selected assert not t.unpack() assert t.f.mode == "failed"
def test_doubledot(self): files = list(AceFile(f("ace_doubledot.ace")).unpack()) assert len(files) == 1 assert files[0].filename == ( "Procurement commercial terms & conditions..exe")
def test_garbage(self): t = AceFile(f("garbage.bin")) assert t.handles() is False with pytest.raises(UnpackException): t.unpack()