From 479e41dc319e698a2ba501b26574b5070f4b9a0f Mon Sep 17 00:00:00 2001 From: Zhaowenlong Date: Thu, 28 May 2026 16:13:41 +0800 Subject: [PATCH] test: align terminal slot fallback expectations --- .../freecad_exchange_template_semantics_test.py | 11 +++++++---- ...ad_exchange_terminal_import_template_slots_test.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/python/freecad_exchange_template_semantics_test.py b/tests/python/freecad_exchange_template_semantics_test.py index 97e4021..444cf25 100644 --- a/tests/python/freecad_exchange_template_semantics_test.py +++ b/tests/python/freecad_exchange_template_semantics_test.py @@ -155,7 +155,7 @@ class TemplateSemanticsRotationTest(unittest.TestCase): class TerminalSlotResolutionPolicyTest(unittest.TestCase): - def test_resolve_terminal_slots_returns_empty_when_model_has_no_template_slots(self): + def test_resolve_terminal_slots_returns_bbox_fallback_when_model_has_no_template_slots(self): _install_fake_freecad() template_semantics, _ = _reload_exchange_modules() @@ -163,9 +163,11 @@ class TerminalSlotResolutionPolicyTest(unittest.TestCase): slots = template_semantics.resolve_terminal_slots(container, "", 2) - self.assertEqual([], slots) + self.assertEqual(2, len(slots)) + self.assertEqual(["fallback", "fallback"], [slot.get("source") for slot in slots]) + self.assertEqual(["SLOT_1", "SLOT_2"], [slot.get("name") for slot in slots]) - def test_resolve_terminal_slots_does_not_pad_template_hints_with_bbox_fallback(self): + def test_resolve_terminal_slots_pads_template_hints_with_bbox_fallback(self): _install_fake_freecad() template_semantics, _ = _reload_exchange_modules() @@ -184,9 +186,10 @@ class TerminalSlotResolutionPolicyTest(unittest.TestCase): slots = template_semantics.resolve_terminal_slots(container, "", 2) - self.assertEqual(1, len(slots)) + self.assertEqual(2, len(slots)) self.assertEqual("P1", slots[0]["name"]) self.assertNotEqual("fallback", slots[0].get("source")) + self.assertEqual("fallback", slots[1].get("source")) class TerminalPlacementTest(unittest.TestCase): diff --git a/tests/python/freecad_exchange_terminal_import_template_slots_test.py b/tests/python/freecad_exchange_terminal_import_template_slots_test.py index 3cc5e51..7636713 100644 --- a/tests/python/freecad_exchange_terminal_import_template_slots_test.py +++ b/tests/python/freecad_exchange_terminal_import_template_slots_test.py @@ -187,7 +187,7 @@ class TerminalImportTemplateSlotPolicyTest(unittest.TestCase): self.assertEqual(1, report["imported_terminals"]) self.assertEqual(0, report.get("skipped_missing_slot")) - self.assertEqual(1, report.get("generated_fallback_slots")) + self.assertEqual(0, report.get("generated_fallback_slots")) self.assertEqual(1, len(terminals)) self.assertEqual("terminal-a", terminals[0].QetTerminalUuid) self.assertEqual("generated_bbox_fallback", terminals[0].QetTerminalGeometrySource)