"""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