Bug Fix für type_converter.py und executor.py
This commit is contained in:
1 parent
5b96bd4f75
commit
a9bd3faabb
5 files changed
+112
-11
No files matched your search
@@ -226,6 +226,14 @@ def test_build_row_after_mapping_column_order_independent():
|
||||
assert r1["resting_hr"] == 58
|
||||
|
||||
|
||||
def test_omron_report_date_formats_without_flexible_flag():
|
||||
"""Omron «Bericht»-Export: engl. Month abbrev + deutscher Monatsname; Vorlage oft nur dd.mm.yyyy."""
|
||||
spec = {"type": "date", "format": "dd.mm.yyyy"}
|
||||
assert convert_value("10 Apr. 2026", "measured_date", spec).isoformat() == "2026-04-10"
|
||||
assert convert_value("31 März 2026", "measured_date", spec).isoformat() == "2026-03-31"
|
||||
assert convert_value("11 März 2026", "measured_date", spec).isoformat() == "2026-03-11"
|
||||
|
||||
|
||||
def test_int_flexible_german_decimal_rounds():
|
||||
"""Apple-DE: HRV/SpO2 als «37,26» / «95,22» — nicht 3726 aus Ziffern konkatenieren."""
|
||||
spec = {"type": "int", "flexible": True}
|
||||
@@ -239,6 +247,25 @@ def test_datetime_flexible():
|
||||
assert dtv.month == 1 and dtv.day == 15 and dtv.hour == 14
|
||||
|
||||
|
||||
def test_apple_workout_datetime_without_seconds_iso_not_swapped():
|
||||
"""Apple Export: 2026-04-09 16:48 — ohne :SS; kein dayfirst-Fehlparser (09↔04)."""
|
||||
spec = {
|
||||
"type": "datetime",
|
||||
"format": "yyyy-mm-dd HH:MM:SS",
|
||||
"extract": "date_and_time",
|
||||
}
|
||||
dtv = convert_value("2026-04-09 16:48", "start_time", spec, module="activity")
|
||||
assert dtv.year == 2026 and dtv.month == 4 and dtv.day == 9
|
||||
assert dtv.hour == 16 and dtv.minute == 48
|
||||
|
||||
|
||||
def test_iso_yyyy_mm_dd_dateutil_fallback_not_dayfirst_swapped():
|
||||
"""Nur dateutil: ISO-Datum darf mit Default-dayfirst nicht vertauscht werden."""
|
||||
spec = {"type": "date", "format": "dd.mm.yyyy", "flexible": True}
|
||||
d = convert_value("2026-04-09", "d", spec)
|
||||
assert d.month == 4 and d.day == 9
|
||||
|
||||
|
||||
def test_source_unit_choices_include_custom_at_end():
|
||||
opts = source_unit_choices_for_field("nutrition", "protein_g")
|
||||
assert opts[-1]["id"] == "custom"
|
||||
|
||||
Reference in new issue
Block a user