CAM: Improved handling of toolbit shape type inference
This commit is contained in:
@@ -156,7 +156,7 @@ class TestPathToolAssetManager(unittest.TestCase):
|
||||
|
||||
with self.assertRaises(ValueError) as cm:
|
||||
manager.get(non_registered_uri)
|
||||
self.assertIn("No asset class registered for asset type:", str(cm.exception))
|
||||
self.assertIn("No asset class registered for URI:", str(cm.exception))
|
||||
|
||||
def test_delete(self):
|
||||
# Setup AssetManager with a real LocalStore
|
||||
@@ -428,7 +428,7 @@ class TestPathToolAssetManager(unittest.TestCase):
|
||||
# This should raise ValueError because uri3 has an unregistered type
|
||||
with self.assertRaises(ValueError) as cm:
|
||||
manager.fetch(store="memory_fetch")
|
||||
self.assertIn("No asset class registered for asset type:", str(cm.exception))
|
||||
self.assertIn("No asset class registered for URI:", str(cm.exception))
|
||||
|
||||
# Now test fetching with a registered asset type filter
|
||||
# Setup a new manager and store to avoid state from previous test
|
||||
|
||||
@@ -94,7 +94,6 @@ class TestPathToolShapeDoc(unittest.TestCase):
|
||||
self.assertEqual(params, {"Diameter": "10 mm", "Length": "50 mm"})
|
||||
mock_freecad.Console.PrintWarning.assert_not_called()
|
||||
|
||||
@patch("Path.Tool.shape.doc.FreeCAD", new=mock_freecad)
|
||||
def test_doc_get_object_properties_missing(self):
|
||||
"""Test get_object_properties handles missing properties with warning."""
|
||||
# Re-import doc within the patch context to use the mocked FreeCAD
|
||||
@@ -107,16 +106,6 @@ class TestPathToolShapeDoc(unittest.TestCase):
|
||||
params = doc_patched.get_object_properties(mock_obj, ["Diameter", "Height"])
|
||||
# Expecting just the values, not tuples
|
||||
self.assertEqual(params, {"Diameter": "10 mm", "Height": None}) # Height is missing
|
||||
expected_calls = [
|
||||
# The 'Could not get type' warning is from base.py's set_parameter,
|
||||
# not get_object_properties. Removing it from expected calls here.
|
||||
call(
|
||||
"Parameter 'Height' not found on object 'MockObjectLabel' "
|
||||
"(MockObjectName). Default value will be used by the shape "
|
||||
"class.\n"
|
||||
)
|
||||
]
|
||||
mock_freecad.Console.PrintWarning.assert_has_calls(expected_calls, any_order=True)
|
||||
|
||||
@patch("FreeCAD.openDocument")
|
||||
@patch("FreeCAD.getDocument")
|
||||
|
||||
Reference in New Issue
Block a user