Harden MCP article and weight workflows
This commit is contained in:
@@ -8,6 +8,7 @@ from roll_calculation import (
|
||||
CalculationState,
|
||||
_canonical_name,
|
||||
article_production_site,
|
||||
calculate_material_weight,
|
||||
calculate_roll,
|
||||
get_article,
|
||||
modify_calculation,
|
||||
@@ -182,6 +183,35 @@ class RollCalculationTests(unittest.TestCase):
|
||||
self.assertEqual(result["status"], "success")
|
||||
self.assertIsNone(result["calculation"]["roll_weight_kg"])
|
||||
|
||||
def test_material_weight_does_not_require_or_assume_a_core_diameter(self):
|
||||
result = calculate_material_weight(
|
||||
roll_length_m=60,
|
||||
width_m=5.0,
|
||||
area_weight_g_m2=4850.079676,
|
||||
)
|
||||
|
||||
self.assertEqual(result["status"], "success")
|
||||
self.assertEqual(result["weight_scope"], "material_only")
|
||||
self.assertAlmostEqual(result["material_weight_kg"], 1455.0239028)
|
||||
self.assertNotIn("core_diameter_mm", result["inputs"])
|
||||
|
||||
def test_roll_diameter_still_rejects_a_zero_core_diameter(self):
|
||||
result = calculate_roll(
|
||||
{
|
||||
"roll_length_m": 60,
|
||||
"width_m": 5.0,
|
||||
"area_weight_g_m2": 4850.079676,
|
||||
"thickness_mm": 6.461044,
|
||||
"core_diameter_mm": 0,
|
||||
"include_roll_weight": True,
|
||||
}
|
||||
)
|
||||
|
||||
self.assertEqual(result["status"], "invalid_parameter")
|
||||
self.assertIn("core_diameter_mm", [
|
||||
item["field"] for item in result["invalid"]
|
||||
])
|
||||
|
||||
def test_diameter_only_calculation_does_not_require_width(self):
|
||||
result = self.calculate_fixture(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user