12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import json
- import pathlib
- import typing
- import pytest
- from location_guessing_game_telegram_bot import _Photo
- @pytest.fixture(scope="session")
- def wikimap_export_path() -> pathlib.Path:
- return pathlib.Path(__file__).parent.joinpath(
- "resources",
- "wikimap.toolforge.org",
- "api.php@cat=Images_with_annotations&lang=de&year=2020-2020®ion=48%7C12%7C47%7C13",
- )
- @pytest.fixture(scope="session")
- def wikimap_export(wikimap_export_path) -> pathlib.Path:
- try:
- return json.loads(wikimap_export_path.read_text())
- except json.decoder.JSONDecodeError as exc:
- if "git-lfs.github.com" in wikimap_export_path.read_text():
- raise ValueError("git-lfs pointers unresolved") from exc
- raise
- @pytest.fixture(scope="session")
- def wikimap_photos(wikimap_export) -> typing.List[_Photo]:
- return [_Photo.from_wikimap_export(attrs) for attrs in wikimap_export]
|