Initial commit - Trekker V2 source
This commit is contained in:
commit
d71faf19e3
65 files changed
+3615
No files matched your search
@@ -0,0 +1,31 @@
|
||||
from app.ingest.gpx_parser import detect_source, parse_gpx
|
||||
|
||||
|
||||
def test_gaia_parse(fixtures):
|
||||
route = parse_gpx((fixtures / "gaia.gpx").read_bytes(), filename="gaia.gpx")
|
||||
assert route.source == "gaia"
|
||||
assert route.name == "Windrock Loop"
|
||||
assert len(route.points) == 7
|
||||
assert len(route.waypoints) == 3
|
||||
assert route.points[0].ele == 400.0
|
||||
assert route.points[0].time.startswith("2026-06-01T10:00:00")
|
||||
|
||||
|
||||
def test_onx_parse(fixtures):
|
||||
route = parse_gpx((fixtures / "onx.gpx").read_bytes())
|
||||
assert route.source == "onx"
|
||||
assert route.name == "Ridge Run"
|
||||
assert len(route.points) == 3
|
||||
assert route.waypoints == []
|
||||
|
||||
|
||||
def test_minimal_parse(fixtures):
|
||||
route = parse_gpx((fixtures / "minimal.gpx").read_bytes(), filename="minimal.gpx")
|
||||
assert route.source == "manual"
|
||||
assert route.name == "minimal"
|
||||
assert all(p.ele is None for p in route.points)
|
||||
|
||||
|
||||
def test_detect_source_namespace_fallback():
|
||||
assert detect_source(None, '<gpx xmlns:onx="http://wwww.onxmaps.com/">') == "onx"
|
||||
assert detect_source("Some App", "<gpx>") == "manual"
|
||||
Reference in new issue
Block a user