sorter: drop non-warhammer game systems (default: Middle-Earth)

The collection is warhammer-only; everything else stays in _unsorted
even when names match the catalog. The catalog snapshot keeps all
systems - the filter is a sorter default (DROPPED_SYSTEMS, applied in
load_catalog and after keyword classification), adjustable with
--drop-system/--keep-system.
This commit is contained in:
2026-10-07 08:03:05 +02:00
parent e13412a5fe
commit 0439071f70
3 changed files with 68 additions and 4 deletions
+26 -1
View File
@@ -30,6 +30,9 @@ CATALOG = {
{"name": "Dark Reapers", "system": "Warhammer 40,000",
"group": "Xenos Armies", "faction": "Aeldari",
"class": "Aspect Warriors", "aliases": []},
{"name": "Mordor Orcs", "system": "Middle-Earth",
"group": "The Lord of the Rings™ - Evil", "faction": "Mordor",
"class": "Warriors", "aliases": []},
]
}
@@ -178,6 +181,27 @@ def test_tokenless_needs_bonus():
shutil.rmtree(root); shutil.rmtree(library)
def test_dropped_system_mordor():
"""Middle-earth is dropped: a 'Mordor' pack lands in _unsorted, and
its inner dirs cannot adopt the (filtered) Mordor Orcs entry."""
root = Path(tempfile.mkdtemp(prefix="sorter_test_src_"))
write(root / "Mordor pack" / "boy.stl")
library = make_lib()
items = sort_plan([root / "Mordor pack" / "boy.stl"], library,
get_catalog(), provenance={"Mordor pack": "Mordor pack.zip"},
root=root)
it = items[0]
assert "Middle-Earth" not in str(it.target), it.target
assert "_unsorted/Mordor pack" in str(it.target).replace("\\", "/")
shutil.rmtree(root); shutil.rmtree(library)
def test_load_catalog_filters_dropped():
cat = load_catalog_path()
assert not any(e["system"] == "Middle-Earth" for e in cat)
assert any(e["name"] == "Warp Spiders" for e in cat)
def test_nonprov_rehome():
"""Loose noise file inside a named dir re-homes to the dir's unit."""
root = Path(tempfile.mkdtemp(prefix="sorter_test_src_"))
@@ -222,7 +246,8 @@ def main():
catalog = load_catalog_path()
for fn in (test_prov_dir_rehome, test_prov_weak_tier, test_nonprov_rehome,
test_cross_system_needs_token_containment, test_apply_weak_doc,
test_weak_needs_shared_token, test_tokenless_needs_bonus):
test_weak_needs_shared_token, test_tokenless_needs_bonus,
test_dropped_system_mordor, test_load_catalog_filters_dropped):
fn()
print("OK", fn.__name__)