mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-17 08:00:13 +01:00
Finalize MDFC follow-ups, docs, and diagnostics tooling
document deck summary DFC badges, exporter annotations, and per-face metadata across README/DOCKER/release notes record completion of all MDFC roadmap follow-ups and add the authoring guide for multi-face CSV entries wire in optional DFC_PER_FACE_SNAPSHOT env support, exporter regression tests, and diagnostics updates noted in the changelog
This commit is contained in:
parent
6fefda714e
commit
88cf832bf2
46 changed files with 3292 additions and 86 deletions
80
code/tests/test_export_mdfc_annotations.py
Normal file
80
code/tests/test_export_mdfc_annotations.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from code.deck_builder.phases.phase6_reporting import ReportingMixin
|
||||
|
||||
|
||||
class DummyBuilder(ReportingMixin):
|
||||
def __init__(self) -> None:
|
||||
self.card_library = {
|
||||
"Valakut Awakening // Valakut Stoneforge": {
|
||||
"Card Type": "Instant",
|
||||
"Count": 2,
|
||||
"Mana Cost": "{2}{R}",
|
||||
"Mana Value": "3",
|
||||
"Role": "",
|
||||
"Tags": [],
|
||||
},
|
||||
"Mountain": {
|
||||
"Card Type": "Land",
|
||||
"Count": 1,
|
||||
"Mana Cost": "",
|
||||
"Mana Value": "0",
|
||||
"Role": "",
|
||||
"Tags": [],
|
||||
},
|
||||
}
|
||||
self.color_identity = ["R"]
|
||||
self.output_func = lambda *_args, **_kwargs: None # silence export logs
|
||||
self._full_cards_df = None
|
||||
self._combined_cards_df = None
|
||||
self.custom_export_base = "test_dfc_export"
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def builder(monkeypatch: pytest.MonkeyPatch) -> DummyBuilder:
|
||||
matrix = {
|
||||
"Valakut Awakening // Valakut Stoneforge": {
|
||||
"R": 1,
|
||||
"_dfc_land": True,
|
||||
"_dfc_counts_as_extra": True,
|
||||
},
|
||||
"Mountain": {"R": 1},
|
||||
}
|
||||
|
||||
def _fake_compute(card_library, *_args, **_kwargs):
|
||||
return matrix
|
||||
|
||||
monkeypatch.setattr(
|
||||
"deck_builder.builder_utils.compute_color_source_matrix",
|
||||
_fake_compute,
|
||||
)
|
||||
return DummyBuilder()
|
||||
|
||||
|
||||
def test_export_decklist_csv_includes_dfc_note(tmp_path: Path, builder: DummyBuilder) -> None:
|
||||
csv_path = Path(builder.export_decklist_csv(directory=str(tmp_path)))
|
||||
with csv_path.open("r", encoding="utf-8", newline="") as handle:
|
||||
reader = csv.DictReader(handle)
|
||||
rows = {row["Name"]: row for row in reader}
|
||||
|
||||
valakut_row = rows["Valakut Awakening // Valakut Stoneforge"]
|
||||
assert valakut_row["DFCNote"] == "MDFC: Adds extra land slot"
|
||||
|
||||
mountain_row = rows["Mountain"]
|
||||
assert mountain_row["DFCNote"] == ""
|
||||
|
||||
|
||||
def test_export_decklist_text_appends_dfc_annotation(tmp_path: Path, builder: DummyBuilder) -> None:
|
||||
text_path = Path(builder.export_decklist_text(directory=str(tmp_path)))
|
||||
lines = text_path.read_text(encoding="utf-8").splitlines()
|
||||
|
||||
valakut_line = next(line for line in lines if line.startswith("2 Valakut Awakening"))
|
||||
assert "[MDFC: Adds extra land slot]" in valakut_line
|
||||
|
||||
mountain_line = next(line for line in lines if line.strip().endswith("Mountain"))
|
||||
assert "MDFC" not in mountain_line
|
||||
Loading…
Add table
Add a link
Reference in a new issue