fix low level issues
This commit is contained in:
+2
-2
@@ -67,10 +67,10 @@ BASE_DETAIL = {
|
||||
|
||||
|
||||
def test_apply_sidecar_title_and_sport():
|
||||
fm = {"title": "Renamed", "sport": "gravel"}
|
||||
fm = {"title": "Renamed", "sport": "running"}
|
||||
result = apply_sidecar(BASE_DETAIL, fm, "")
|
||||
assert result["title"] == "Renamed"
|
||||
assert result["sport"] == "gravel"
|
||||
assert result["sport"] == "running"
|
||||
# Original must be unchanged
|
||||
assert BASE_DETAIL["title"] == "Morning Ride"
|
||||
|
||||
|
||||
+20
-1
@@ -1,4 +1,4 @@
|
||||
from bincio.extract.sport import normalise_sport
|
||||
from bincio.extract.sport import normalise_sport, normalise_sub_sport
|
||||
|
||||
|
||||
def test_cycling_variants():
|
||||
@@ -14,3 +14,22 @@ def test_running_variants():
|
||||
def test_unknown_falls_back_to_other():
|
||||
assert normalise_sport("yoga") == "other"
|
||||
assert normalise_sport(None) == "other"
|
||||
|
||||
|
||||
def test_sub_sport_strava_camelcase():
|
||||
assert normalise_sub_sport("MountainBikeRide") == "mountain"
|
||||
assert normalise_sub_sport("GravelRide") == "gravel"
|
||||
assert normalise_sub_sport("VirtualRide") == "indoor"
|
||||
assert normalise_sub_sport("Ride") == "road"
|
||||
|
||||
|
||||
def test_sub_sport_ski_variants():
|
||||
assert normalise_sub_sport("AlpineSki") == "alpine"
|
||||
assert normalise_sub_sport("NordicSki") == "nordic"
|
||||
assert normalise_sub_sport("BackcountrySki") == "nordic"
|
||||
|
||||
|
||||
def test_sub_sport_unknown_returns_none():
|
||||
assert normalise_sub_sport("yoga") is None
|
||||
assert normalise_sub_sport(None) is None
|
||||
assert normalise_sub_sport("generic") is None
|
||||
|
||||
@@ -18,16 +18,13 @@ def _dummy_activity(title=None):
|
||||
def test_id_with_title():
|
||||
act = _dummy_activity("Morning Ride")
|
||||
aid = make_activity_id(act)
|
||||
assert aid.startswith("2024-06-01T")
|
||||
assert "morning-ride" in aid
|
||||
assert aid == "2024-06-01T073012Z-morning-ride"
|
||||
|
||||
|
||||
def test_id_without_title():
|
||||
act = _dummy_activity()
|
||||
aid = make_activity_id(act)
|
||||
assert "2024-06-01T" in aid
|
||||
# No trailing dash
|
||||
assert not aid.endswith("-")
|
||||
assert aid == "2024-06-01T073012Z"
|
||||
|
||||
|
||||
def test_slugify():
|
||||
|
||||
Reference in New Issue
Block a user