fix: FDDB-Zeilen im CSV-Import speichern und in Ernährung zeigen
Bezeichnung/Menge auch ohne Vorlagen-Mapping, Zuordnen-Hinweis, Tagesliste mit Lebensmitteln. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a07a668de2
commit
4b1be3019d
7 files changed
+141
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
from csv_parser.executor import guess_nutrition_item_fields
|
||||
from data_layer.food_mapping import normalize_food_name, parse_quantity_g
|
||||
from data_layer.nutrition_items import macros_differ
|
||||
|
||||
@@ -13,6 +14,16 @@ def test_parse_quantity_g():
|
||||
assert parse_quantity_g("1 Stück") is None
|
||||
|
||||
|
||||
def test_guess_fddb_bezeichnung_without_template_mapping():
|
||||
name, qty = guess_nutrition_item_fields({
|
||||
"bezeichnung": "50 g Hähnchen",
|
||||
"menge": "50 g",
|
||||
"kj": "800",
|
||||
})
|
||||
assert name == "50 g Hähnchen"
|
||||
assert qty == "50 g"
|
||||
|
||||
|
||||
def test_macros_differ_rounds():
|
||||
assert not macros_differ({"kcal": 1.04, "protein_g": 0, "fat_g": 0, "carbs_g": 0}, {"kcal": 1.0, "protein_g": 0, "fat_g": 0, "carbs_g": 0})
|
||||
assert macros_differ({"kcal": 10, "protein_g": 0, "fat_g": 0, "carbs_g": 0}, {"kcal": 11, "protein_g": 0, "fat_g": 0, "carbs_g": 0})
|
||||
Reference in new issue
Block a user