mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
refactor: judge a data hit on the indexed roots
This commit is contained in:
1 parent
93d45b6241
commit
8a9591dad2
6 files changed
+49
-28
No files matched your search
@@ -4405,15 +4405,13 @@ class ASameNamedMemberIsNotTheFile(unittest.TestCase):
|
||||
with zipfile.ZipFile(tmp / "bios" / "extras.zip", "w") as zf:
|
||||
zf.writestr("files/other.ttf", b"MEMBER FONT")
|
||||
names = crossref.build_supplemental_index(str(tmp / "data"), str(tmp / "bios"))
|
||||
locations = crossref._supplemental_locations(str(tmp / "data"), str(tmp / "bios"))
|
||||
with mock.patch.object(crossref, "_supplemental_locations", lambda: locations):
|
||||
for fname, data in (("font.ttf", b"DATA FONT"), ("other.ttf", b"MEMBER FONT")):
|
||||
with self.subTest(name=fname):
|
||||
held = {"name": fname, "sha1": hashlib.sha1(data).hexdigest()}
|
||||
other = {"name": fname, "sha1": "0" * 40}
|
||||
self.assertTrue(crossref._data_hit(fname, None, held, names))
|
||||
self.assertFalse(crossref._data_hit(fname, None, other, names))
|
||||
self.assertTrue(crossref._data_hit(fname, None, {"name": fname}, names))
|
||||
for fname, data in (("font.ttf", b"DATA FONT"), ("other.ttf", b"MEMBER FONT")):
|
||||
with self.subTest(name=fname):
|
||||
held = {"name": fname, "sha1": hashlib.sha1(data).hexdigest()}
|
||||
other = {"name": fname, "sha1": "0" * 40}
|
||||
self.assertTrue(crossref._data_hit(fname, None, held, names))
|
||||
self.assertFalse(crossref._data_hit(fname, None, other, names))
|
||||
self.assertTrue(crossref._data_hit(fname, None, {"name": fname}, names))
|
||||
|
||||
|
||||
class AnEmptyTargetIsNotEveryCore(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user