Esempio n. 1
0
 def read(self, path: Path, oracle: Oracle) -> MagicCollection:
     """Read collection from an xlsx file."""
     workbook = openpyxl.load_workbook(filename=str(path), read_only=True)
     reader = rows_for_workbook(workbook,
                                skip_sheets={"All Sets", "All Cards"})
     card_counts = counts.aggregate_card_counts(reader, oracle)
     return MagicCollection(oracle=oracle, counts=card_counts)
Esempio n. 2
0
File: csv.py Progetto: gwax/mtg_ssm
 def read(self, path: Path, oracle: Oracle) -> MagicCollection:
     """Read collection from file."""
     with path.open("rt", encoding="utf-8") as csv_file:
         reader = csv.DictReader(csv_file)
         card_counts = counts.aggregate_card_counts(reader, oracle)
     return MagicCollection(oracle=oracle, counts=card_counts)
Esempio n. 3
0
def test_aggregate_card_counts(oracle: Oracle, card_rows: List[Dict[str, Any]],
                               output: counts.ScryfallCardCount) -> None:
    assert counts.aggregate_card_counts(card_rows, oracle) == output