mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-17 08:00:13 +01:00
Bracket enforcement + inline gating; global pool prune; compliance JSON artifacts; UI combos gating; compose envs consolidated; fix YAML; bump version to 2.2.5
This commit is contained in:
parent
42c8fc9f9e
commit
4e03997923
32 changed files with 2819 additions and 125 deletions
53
code/tests/test_brackets_compliance.py
Normal file
53
code/tests/test_brackets_compliance.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from deck_builder.brackets_compliance import evaluate_deck
|
||||
|
||||
|
||||
def _mk_card(tags: list[str] | None = None):
|
||||
return {
|
||||
"Card Name": "X",
|
||||
"Card Type": "Sorcery",
|
||||
"Tags": list(tags or []),
|
||||
"Count": 1,
|
||||
}
|
||||
|
||||
|
||||
def test_exhibition_fails_on_game_changer():
|
||||
deck = {
|
||||
"Sol Ring": _mk_card(["Bracket:GameChanger"]),
|
||||
"Cultivate": _mk_card([]),
|
||||
}
|
||||
rep = evaluate_deck(deck, commander_name=None, bracket="exhibition")
|
||||
assert rep["level"] == 1
|
||||
assert rep["categories"]["game_changers"]["status"] == "FAIL"
|
||||
assert rep["overall"] == "FAIL"
|
||||
|
||||
|
||||
def test_core_allows_some_extra_turns_but_fails_over_limit():
|
||||
deck = {
|
||||
f"Time Warp {i}": _mk_card(["Bracket:ExtraTurn"]) for i in range(1, 5)
|
||||
}
|
||||
rep = evaluate_deck(deck, commander_name=None, bracket="core")
|
||||
assert rep["level"] == 2
|
||||
assert rep["categories"]["extra_turns"]["limit"] == 3
|
||||
assert rep["categories"]["extra_turns"]["count"] == 4
|
||||
assert rep["categories"]["extra_turns"]["status"] == "FAIL"
|
||||
assert rep["overall"] == "FAIL"
|
||||
|
||||
|
||||
def test_two_card_combination_detection_respects_cheap_early():
|
||||
deck = {
|
||||
"Thassa's Oracle": _mk_card([]),
|
||||
"Demonic Consultation": _mk_card([]),
|
||||
"Isochron Scepter": _mk_card([]),
|
||||
"Dramatic Reversal": _mk_card([]),
|
||||
}
|
||||
# Exhibition should fail due to presence of a cheap/early pair
|
||||
rep1 = evaluate_deck(deck, commander_name=None, bracket="exhibition")
|
||||
assert rep1["categories"]["two_card_combos"]["count"] >= 1
|
||||
assert rep1["categories"]["two_card_combos"]["status"] == "FAIL"
|
||||
|
||||
# Optimized has no limit
|
||||
rep2 = evaluate_deck(deck, commander_name=None, bracket="optimized")
|
||||
assert rep2["categories"]["two_card_combos"]["limit"] is None
|
||||
assert rep2["overall"] == "PASS"
|
||||
Loading…
Add table
Add a link
Reference in a new issue