Open the-infinity opened 3 weeks ago
I have created PR for this.
@the-infinity I also noticed the list variable sources_to_ignore
in the current converter.py
is empty, and defined as environment variable in order to avoid duplicate parking sites. When I leave it empty, I get AssertionError below and doesn't pass the GitHub lint test.
Now I have added "MOBIDATABW" to the empty variable sources_to_ignore
in the PR and the AssertionError is gone...Is that okay?
=================================== FAILURES ===================================
_____________ RadvisBwConverterTest.test_get_static_parking_sites ______________
radvis_bw_pull_converter = <parkapi_sources.converters.radvis_bw.converter.RadvisBwPullConverter object at 0x7f4c5b6c3790>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f4c5b305570>
@staticmethod
def test_get_static_parking_sites(radvis_bw_pull_converter: RadvisBwPullConverter, requests_mock: Mocker):
json_path = Path(Path(__file__).parent, 'data', 'radvis_bw.json')
with json_path.open() as json_file:
json_data = json_file.read()
requests_mock.get(
'https://radvis.landbw.de/api/geoserver/basicauth/radvis/wfs?service=WFS&version=2.0.0&request=GetFeature'
'&typeNames=radvis%3Aabstellanlage&outputFormat=application/json',
text=json_data,
)
static_parking_site_inputs, import_parking_site_exceptions = radvis_bw_pull_converter.get_static_parking_sites()
> assert len(static_parking_site_inputs) == 690
E AssertionError: assert 3034 == 690
E + where 3034 = len([StaticParkingSiteInput(uid='15176[65](https://github.com/ParkenDD/parkapi-sources-v3/actions/runs/11890892696/job/33130492627#step:6:66)02', name='Abstellanlage', group_uid='151766502', purpose=<PurposeType.BIKE: 'BIKE...ty_truck=UnsetValue, capacity_bus=UnsetValue, opening_hours=UnsetValue, external_identifiers=UnsetValue, tags=[]), ...])
tests/converters/radvis_bw_test.py:45: AssertionError
=========================== short test summary info ============================
FAILED tests/converters/radvis_bw_test.py::RadvisBwConverterTest::test_get_static_parking_sites - AssertionError: assert 3034 == 690
+ where 3034 = len([StaticParkingSiteInput(uid='1517[66](https://github.com/ParkenDD/parkapi-sources-v3/actions/runs/11890892696/job/33130492627#step:6:67)502', name='Abstellanlage', group_uid='151766502', purpose=<PurposeType.BIKE: 'BIKE...ty_truck=UnsetValue, capacity_bus=UnsetValue, opening_hours=UnsetValue, external_identifiers=UnsetValue, tags=[]), ...])
Please do not hardode such values. There are two approaches to resolves this:
1) set the PARK_API_RADVIS_IGNORE_SOURCES
in your mocked test
2) change the number of results in the tests, which would be reasonable as you also updated the test data
Thanks for the Tips, It has now been updated.
abstellanlagen_ort
seems to have a new enum value,BILDUNGSEINRICHTUNG
. This should be supported at ParkAPI Sources.