mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
fix: one size predicate, size_options retired
This commit is contained in:
1 parent
a090e64336
commit
0d7939588e
16 files changed
+115
-61
No files matched your search
@@ -198,6 +198,19 @@ class AgnosticFallback(unittest.TestCase):
|
||||
}
|
||||
self.assertIsNotNone(common._resolve_agnostic(entry, self.files_db, False))
|
||||
|
||||
def test_a_list_of_accepted_sizes_is_honoured(self):
|
||||
entry = {
|
||||
"agnostic": True,
|
||||
"agnostic_path_prefix": str(self.root),
|
||||
"size": [32, 64],
|
||||
}
|
||||
self.assertEqual(
|
||||
common._resolve_agnostic(entry, self.files_db, False),
|
||||
(str(self.match), "agnostic_fallback"),
|
||||
)
|
||||
entry["size"] = [32, 65]
|
||||
self.assertIsNone(common._resolve_agnostic(entry, self.files_db, False))
|
||||
|
||||
def test_without_a_prefix_nothing_is_scanned(self):
|
||||
entry = {"agnostic": True, "size": 64}
|
||||
self.assertIsNone(common._resolve_agnostic(entry, self.files_db, False))
|
||||
@@ -207,5 +220,31 @@ class AgnosticFallback(unittest.TestCase):
|
||||
self.assertIsNone(common._resolve_agnostic(entry, self.files_db, False))
|
||||
|
||||
|
||||
class OneSpellingForAcceptedSizes(unittest.TestCase):
|
||||
"""A set of sizes the code accepts is ``size: [a, b]`` and nothing else.
|
||||
|
||||
SC-55/ROM2.BIN declared its two sizes under a field the resolver never
|
||||
read and resolved by name to a PlayStation 2 ROM of a third size.
|
||||
"""
|
||||
|
||||
def test_no_profile_uses_a_second_field(self):
|
||||
offenders = [
|
||||
path.name
|
||||
for path in sorted((REPO_ROOT / "emulators").glob("*.yml"))
|
||||
if "size_options" in path.read_text(encoding="utf-8")
|
||||
]
|
||||
self.assertEqual(offenders, [])
|
||||
|
||||
def test_the_schema_refuses_the_second_field(self):
|
||||
import json
|
||||
|
||||
schema = json.loads(
|
||||
(REPO_ROOT / "schemas/emulator.schema.json").read_text(encoding="utf-8")
|
||||
)
|
||||
file_entry = schema["properties"]["files"]["items"]["properties"]
|
||||
self.assertNotIn("size_options", file_entry)
|
||||
self.assertEqual(file_entry["size"]["type"], ["integer", "array", "null"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user