-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
962 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Tests for imgw-pib package.""" |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Set up some common test helper things.""" | ||
|
||
import json | ||
from pathlib import Path | ||
from typing import Any, Self, cast | ||
|
||
import pytest | ||
from syrupy.assertion import SnapshotAssertion | ||
from syrupy.extensions.amber import AmberSnapshotExtension | ||
from syrupy.location import PyTestLocation | ||
|
||
|
||
@pytest.fixture() | ||
def weather_stations() -> list[dict[str, Any]]: | ||
"""Return weather stations data from the fixture file.""" | ||
with Path.open("tests/fixtures/weather_stations.json", encoding="utf-8") as file: | ||
return cast(list[dict[str, Any]], json.load(file)) | ||
|
||
|
||
@pytest.fixture() | ||
def weather_station() -> dict[str, Any]: | ||
"""Return weather station data from the fixture file.""" | ||
with Path.open("tests/fixtures/weather_station.json", encoding="utf-8") as file: | ||
return cast(dict[str, Any], json.load(file)) | ||
|
||
|
||
@pytest.fixture() | ||
def snapshot(snapshot: SnapshotAssertion) -> SnapshotAssertion: | ||
"""Return snapshot assertion fixture.""" | ||
return snapshot.use_extension(SnapshotExtension) | ||
|
||
|
||
class SnapshotExtension(AmberSnapshotExtension): | ||
"""Extension for Syrupy.""" | ||
|
||
@classmethod | ||
def dirname(cls: Self, *, test_location: PyTestLocation) -> str: | ||
"""Return the directory for the snapshot files.""" | ||
test_dir = Path(test_location.filepath).parent | ||
return str(test_dir.joinpath("snapshots")) |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"id_stacji": "12600", | ||
"stacja": "Bielsko Bia\u0142a", | ||
"data_pomiaru": "2024-04-22", | ||
"godzina_pomiaru": "7", | ||
"temperatura": "0.8", | ||
"predkosc_wiatru": "1", | ||
"kierunek_wiatru": "310", | ||
"wilgotnosc_wzgledna": "93.0", | ||
"suma_opadu": "18.1", | ||
"cisnienie": "1022.1" | ||
} |
Oops, something went wrong.