1234567891011121314151617181920212223242526272829303132333435 |
- import pytest
- from copy import deepcopy
- @pytest.fixture
- def station_data():
- js = {
- "code": "abdl",
- "height": 162.27803882118315,
- "status": "new",
- "location": {
- "lat": 53.68908284179442,
- "lon": 53.64383132493483
- },
- "xyz": [
- 2243908.9008,
- 3048443.7188,
- 5116457.9962
- ]
- }
- return js
- class TestStation:
- def test_creation(self):
- try:
- Station(**js)
- except Exception as e:
- pytest.fail(f"Failed with exception '{type(e)} - {e}'")
- for field in ["code", "height", "status", "location"]:
- js_copy = deepcopy(js)
- del js["location"]
- with pytest.raises(StationError):
- Station(**js)
|