From 02676f841c10b20e1a69b6936acb60dfc46da5c4 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sun, 24 Jul 2022 22:28:38 +0200 Subject: add first basic tests for synthetic tracks --- tests/assets/Synthetic_BRouter_1.gpx.gz | Bin 0 -> 697 bytes tests/assets/Synthetic_WT2.gpx.gz | Bin 0 -> 18941 bytes tests/unit/test_util.py | 13 +++++++++++++ 3 files changed, 13 insertions(+) create mode 100644 tests/assets/Synthetic_BRouter_1.gpx.gz create mode 100644 tests/assets/Synthetic_WT2.gpx.gz diff --git a/tests/assets/Synthetic_BRouter_1.gpx.gz b/tests/assets/Synthetic_BRouter_1.gpx.gz new file mode 100644 index 0000000..e380fc7 Binary files /dev/null and b/tests/assets/Synthetic_BRouter_1.gpx.gz differ diff --git a/tests/assets/Synthetic_WT2.gpx.gz b/tests/assets/Synthetic_WT2.gpx.gz new file mode 100644 index 0000000..eb74472 Binary files /dev/null and b/tests/assets/Synthetic_WT2.gpx.gz differ diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py index debf229..b35f218 100644 --- a/tests/unit/test_util.py +++ b/tests/unit/test_util.py @@ -66,6 +66,19 @@ def test_guess_gpx_timezone(gpx_file, offset): assert timezone.utcoffset(None) == offset +@pytest.mark.parametrize('gpx_file', [ + 'Teasi_1.gpx.gz', + 'MyTourbook_1.gpx.gz', + 'Synthetic_WT2.gpx.gz', + 'Synthetic_BRouter_1.gpx.gz', +]) +def test_tour_metadata(gpx_file): + # Here we simply make sure that we do not crash the metadata extraction + # function. + gpx_data = load_gpx_asset(gpx_file) + assert util.tour_metadata(gpx_data) is not None + + @pytest.mark.parametrize('mps, kph', [(1, 3.6), (10, 36)]) def test_mps_to_kph(mps, kph): assert util.mps_to_kph(mps) == pytest.approx(kph, 0.1) -- cgit v1.2.3