-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Maciej Bieniek <[email protected]>
- Loading branch information
Showing
5 changed files
with
47 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ pytest-error-for-skips==2.0.2 | |
pytest-timeout==2.3.1 | ||
pytest==8.1.1 | ||
ruff==0.3.7 | ||
syrupy==4.6.1 |
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,24 @@ | ||
"""Set up some common test helper things.""" | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
from syrupy.assertion import SnapshotAssertion | ||
from syrupy.extensions.amber import AmberSnapshotExtension | ||
from syrupy.location import PyTestLocation | ||
|
||
|
||
@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, *, 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,13 @@ | ||
# serializer version: 1 | ||
# name: test_no_indexes_data | ||
GiosSensors(aqi=None, c6h6=Sensor(name='benzene', id=658, index=None, value=2.57148), co=Sensor(name='carbon monoxide', id=660, index=None, value=786.702), no2=Sensor(name='nitrogen dioxide', id=665, index=None, value=59.9545), o3=Sensor(name='ozone', id=667, index=None, value=8.63111), pm10=Sensor(name='particulate matter 10', id=14395, index=None, value=123.879), pm25=Sensor(name='particulate matter 2.5', id=670, index=None, value=59.9428), so2=Sensor(name='sulfur dioxide', id=672, index=None, value=11.6502)) | ||
# --- | ||
# name: test_valid_data_first_value | ||
GiosSensors(aqi=Sensor(name='AQI', id=None, index=None, value='good'), c6h6=Sensor(name='benzene', id=658, index='very_good', value=2.57148), co=Sensor(name='carbon monoxide', id=660, index='very_bad', value=786.702), no2=Sensor(name='nitrogen dioxide', id=665, index='very_good', value=59.9545), o3=Sensor(name='ozone', id=667, index='bad', value=8.63111), pm10=Sensor(name='particulate matter 10', id=14395, index='moderate', value=123.879), pm25=Sensor(name='particulate matter 2.5', id=670, index='sufficient', value=59.9428), so2=Sensor(name='sulfur dioxide', id=672, index='very_good', value=11.6502)) | ||
# --- | ||
# name: test_valid_data_first_value.1 | ||
GiosSensors(aqi=Sensor(name='AQI', id=None, index=None, value='good'), c6h6=Sensor(name='benzene', id=658, index='very_good', value=2.57148), co=Sensor(name='carbon monoxide', id=660, index='very_bad', value=786.702), no2=Sensor(name='nitrogen dioxide', id=665, index='very_good', value=59.9545), o3=Sensor(name='ozone', id=667, index='bad', value=8.63111), pm10=Sensor(name='particulate matter 10', id=14395, index='moderate', value=123.879), pm25=Sensor(name='particulate matter 2.5', id=670, index='sufficient', value=59.9428), so2=Sensor(name='sulfur dioxide', id=672, index='very_good', value=11.6502)) | ||
# --- | ||
# name: test_valid_data_second_value | ||
GiosSensors(aqi=Sensor(name='AQI', id=None, index=None, value='good'), c6h6=Sensor(name='benzene', id=658, index='very_good', value=3.24432), co=Sensor(name='carbon monoxide', id=660, index='very_bad', value=1041.74), no2=Sensor(name='nitrogen dioxide', id=665, index='very_good', value=52.6198), o3=Sensor(name='ozone', id=667, index='bad', value=4.93778), pm10=Sensor(name='particulate matter 10', id=14395, index='moderate', value=115.559), pm25=Sensor(name='particulate matter 2.5', id=670, index='sufficient', value=72.0243), so2=Sensor(name='sulfur dioxide', id=672, index='very_good', value=11.501)) | ||
# --- |
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