Интегрирован wesp в сайт
CI / quality (push) Canceled after 0s

This commit is contained in:
влад
2026-07-17 12:57:18 +03:00
parent 5dfa06ddbe
commit 355c0ef9f1
883 changed files with 194576 additions and 177 deletions
+35
View File
@@ -0,0 +1,35 @@
"""Golden parity with tab/packages/calc-engine/src/native/golden-test.ts"""
from app.lab.calc.engine import calculate_ration
def test_beef_ration_total_and_compound():
result = calculate_ration(
"BEEF",
[
{
"daily_kg": 80,
"in_ration": True,
"in_compound": True,
"ingredient_name": "Тест",
"price_per_kg": 10,
"dry_matter": 880,
"nutrients": {"Сыр. Протеин": 120, "ОЭ-КРС": 6.5, " ЧЭЛ- КРС": 7.2},
},
{
"daily_kg": 20,
"in_ration": True,
"in_compound": False,
"price_per_kg": 5,
"dry_matter": 900,
"nutrients": {"Сыр. Протеин": 100},
},
],
{"dry_matter": {"min": 4000, "max": 5000}},
)
total = next(t["value"] for t in result["totals"] if t["key"] == "total_kg")
assert total == 100
assert result["compound"] is not None
assert result["compound"]["totals"][0]["value"] == 80
cp = next(i for i in result["indicators"] if "Сырой протеин" in i["label"])
assert cp["content"] is not None and cp["content"] >= 11000