-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,41 @@ | ||
from pathlib import Path | ||
from tempfile import TemporaryDirectory | ||
|
||
import pytest | ||
|
||
def test_print_pdf(): | ||
from mtgproxies import fetch_scans_scryfall, print_cards_fpdf | ||
|
||
@pytest.fixture(scope="module") | ||
def example_images() -> list[str]: | ||
from mtgproxies import fetch_scans_scryfall | ||
from mtgproxies.decklists import parse_decklist | ||
|
||
decklist, _, _ = parse_decklist("examples/decklist.txt") | ||
decklist, _, _ = parse_decklist(Path(__file__).parent.parent / "examples/decklist.txt") | ||
images = fetch_scans_scryfall(decklist) | ||
|
||
with TemporaryDirectory() as dir: | ||
out_file = Path(dir) / "decklist.pdf" | ||
return images | ||
|
||
print_cards_fpdf(images, out_file) | ||
|
||
assert out_file.is_file() | ||
def test_print_cards_fpdf(example_images: list[str], tmp_path: Path): | ||
from mtgproxies import print_cards_fpdf | ||
|
||
out_file = tmp_path / "decklist.pdf" | ||
print_cards_fpdf(example_images, out_file) | ||
|
||
def test_print_png(): | ||
from mtgproxies import fetch_scans_scryfall, print_cards_matplotlib | ||
from mtgproxies.decklists import parse_decklist | ||
assert out_file.is_file() | ||
|
||
|
||
def test_print_cards_matplotlib_pdf(example_images: list[str], tmp_path: Path): | ||
from mtgproxies import print_cards_matplotlib | ||
|
||
out_file = tmp_path / "decklist.pdf" | ||
print_cards_matplotlib(example_images, out_file) | ||
|
||
assert out_file.is_file() | ||
|
||
decklist, _, _ = parse_decklist("examples/decklist.txt") | ||
images = fetch_scans_scryfall(decklist) | ||
|
||
with TemporaryDirectory() as dir: | ||
out_file = Path(dir) / "decklist.png" | ||
def test_print_cards_matplotlib_png(example_images: list[str], tmp_path: Path): | ||
from mtgproxies import print_cards_matplotlib | ||
|
||
print_cards_matplotlib(images, str(out_file)) | ||
out_file = tmp_path / "decklist.png" | ||
print_cards_matplotlib(example_images, out_file) | ||
|
||
assert (Path(dir) / "decklist_000.png").is_file() | ||
assert (tmp_path / "decklist_000.png").is_file() |