Frankreich, Niederlande, Belgien als weitere Quellen (noch im Test)
- Quellen fr (SNCF), nl (OVapi), be (GTFS.be), Kacheln für alle 5 Länder - Landesgrenzen für 5 Länder (borders.json), Gitter-Cache für die Prüfung - Echtzeit-Abgleich auch über Haltestellen-ID (FR, NL), über den Bahnhof bei Gleiswechsel - SNCF: Gattung aus der Trip-ID, Zugnummer aus dem Headsign; NL-Linien gekürzt - calendar.txt optional (SNCF hat nur calendar_dates) - OSM je Land zugeschnitten vor pfaedle; beim Zusammenführen je Objekt nur die neueste Version (time-filter) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X48pE4bzjHej8w9HyZXCjb
This commit is contained in:
+23
-2
@@ -130,6 +130,17 @@ def test_all():
|
||||
v = f.vehicles(at(8, 24), rt) # Verspätung pflanzt sich bis Gamma fort
|
||||
assert v and v[0]["properties"]["delay"] == 300
|
||||
|
||||
# Frankreich/Niederlande: nur stop_id, kein stop_sequence
|
||||
fm = pb.FeedMessage()
|
||||
fm.header.gtfs_realtime_version = "2.0"
|
||||
e = fm.entity.add(id="1")
|
||||
e.trip_update.trip.trip_id, e.trip_update.trip.start_date = "T1", "20261021"
|
||||
st = e.trip_update.stop_time_update.add(stop_id="B")
|
||||
st.arrival.delay = st.departure.delay = 300
|
||||
_, rt = realtime.parse(fm.SerializeToString(), f.trip_index)
|
||||
assert rt[("T1", "20261021")][1][0][0] is None
|
||||
assert f.vehicles(at(8, 14), rt)[0]["properties"]["delay"] == 300
|
||||
|
||||
_, rt = realtime.parse(rt_feed(cancel=True), f.trip_index)
|
||||
assert f.vehicles(at(8, 5), rt) == []
|
||||
|
||||
@@ -154,11 +165,21 @@ def test_all():
|
||||
assert long_distance("", "ICE 75") and long_distance("IR", "IR36") and long_distance("", "ECE 20")
|
||||
assert not long_distance("S", "S5") and not long_distance("", "RE6") and not long_distance("", "IRE 3")
|
||||
assert not long_distance("TER", "K1") and not long_distance("", "")
|
||||
assert long_distance("", "NJ") and long_distance("TGV", "") and long_distance("OUIGO", "")
|
||||
from trainpulse.feed import LINE_PREFIX
|
||||
assert LINE_PREFIX.sub("", "Stoptrein RS4") == "RS4" and LINE_PREFIX.sub("", "Intercity direct") == "Intercity direct"
|
||||
|
||||
from trainpulse.border import SHOW, in_switzerland
|
||||
from trainpulse.border import country, in_switzerland, shows
|
||||
assert in_switzerland(8.540, 47.378) and not in_switzerland(9.177, 47.659) # Zürich HB / Konstanz
|
||||
assert not in_switzerland(8.690, 47.697) # Büsingen (deutsche Exklave)
|
||||
assert SHOW["ch"](8.54, 47.378) and not SHOW["de"](8.54, 47.378)
|
||||
places = {(2.355, 48.881): "fr", (4.357, 50.836): "be", (4.900, 52.379): "nl", (13.369, 52.525): "de",
|
||||
(8.540, 47.378): "ch", (6.13, 49.61): None, (11.40, 47.26): None} # Paris, Brüssel, Amsterdam,
|
||||
for (x, y), c in places.items(): # Berlin, Zürich, Luxemburg, Innsbruck
|
||||
assert country(x, y) == c, (x, y, country(x, y))
|
||||
both = {"ch", "de"}
|
||||
assert shows("ch", both, 8.54, 47.378) and not shows("de", both, 8.54, 47.378)
|
||||
assert shows("de", both, 11.40, 47.26) and shows("ch", both, 11.40, 47.26) # Ausland: beide
|
||||
assert shows("de", both, 2.355, 48.881) # Frankreich ohne eigenen Fahrplan -> DE zeigt
|
||||
print("alle Tests ok")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user