mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-17 08:00:13 +01:00
feat(tagging+archetypes): add Pillowfort/Politics/Midrange/Toolbox tagging and unify archetype presence skip logic
This commit is contained in:
parent
f2a76d2ffc
commit
6d6243d6be
47 changed files with 21133 additions and 839 deletions
37
code/tests/test_description_mapping_validation.py
Normal file
37
code/tests/test_description_mapping_validation.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SCRIPT = ROOT / 'code' / 'scripts' / 'build_theme_catalog.py'
|
||||
VALIDATE = ROOT / 'code' / 'scripts' / 'validate_description_mapping.py'
|
||||
TEMP_OUT = ROOT / 'config' / 'themes' / 'theme_list_mapping_test.json'
|
||||
|
||||
|
||||
def test_description_mapping_validator_runs():
|
||||
res = subprocess.run([sys.executable, str(VALIDATE)], capture_output=True, text=True)
|
||||
assert res.returncode == 0, res.stderr or res.stdout
|
||||
assert 'Mapping OK' in (res.stdout + res.stderr)
|
||||
|
||||
|
||||
def test_mapping_applies_to_catalog():
|
||||
env = os.environ.copy()
|
||||
env['EDITORIAL_INCLUDE_FALLBACK_SUMMARY'] = '1'
|
||||
# Build catalog to alternate path
|
||||
res = subprocess.run([sys.executable, str(SCRIPT), '--output', str(TEMP_OUT)], capture_output=True, text=True, env=env)
|
||||
assert res.returncode == 0, res.stderr
|
||||
data = json.loads(TEMP_OUT.read_text(encoding='utf-8'))
|
||||
themes = data.get('themes', [])
|
||||
assert themes, 'No themes generated'
|
||||
# Pick a theme that should clearly match a mapping rule (e.g., contains "Treasure")
|
||||
mapped = [t for t in themes if 'Treasure' in t.get('theme','')]
|
||||
if mapped:
|
||||
desc = mapped[0].get('description','')
|
||||
assert 'Treasure tokens' in desc or 'Treasure token' in desc
|
||||
# Clean up
|
||||
try:
|
||||
TEMP_OUT.unlink()
|
||||
except Exception:
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue