FahrplanDatenGarten / pyhafas

A python client for the HAFAS (HaCon Fahrplan Auskunfts System)
https://pyhafas.readthedocs.io
MIT License
47 stars 20 forks source link

Update and fix tests #41

Closed sn0opy closed 5 months ago

sn0opy commented 7 months ago

Several tests failed due to the date/time in the journey() request being out of the timetable period. I fixed that by actually using the current date. I assume this could still fail on public holidays or weekends with a different timetables.

Some others failed because I was running tests on a Windows machine which is using a different encoding when opening files which broke German umlauts. Passing the correct encoding to open() fixes that.

The nasa/requests/journeys_test.py still fails with the following error: location missing or invalid. After double checking the station IDs they seem to be valid and one can still request journeys at https://reiseauskunft.insa.de/ and https://www.insa.de/fahrplanauskunft. No idea why.

leona-ya commented 5 months ago

I'll make a different version based on this PR as the DB updated their HAFAS tonight and with that changed the journey id format from seperated by the legacy | to #. Thanks tho :3

leona-ya commented 5 months ago

I fixed the tests a bit different because your fix relied on the fact that timetables don't change. See 7d9c3895cb50afe21862121783c6f24053653fd2 and 64832a38e0985a4709f864f948cb3ecbebaa94d1