From e34cebf04347212ec06b80fe0984dc8f6502e028 Mon Sep 17 00:00:00 2001 From: yuqei Date: Fri, 1 May 2026 05:53:06 -0400 Subject: [PATCH] test: lock bridge guard positive diagnostics --- tests/unit/test_documentation_consistency.py | 80 ++++++++++++++------ 1 file changed, 58 insertions(+), 22 deletions(-) diff --git a/tests/unit/test_documentation_consistency.py b/tests/unit/test_documentation_consistency.py index 34bc4a7..52e3ada 100644 --- a/tests/unit/test_documentation_consistency.py +++ b/tests/unit/test_documentation_consistency.py @@ -130,9 +130,15 @@ TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY = ( "test_training_m66_release_index_source_shape_fixture_guard_methods_constant_source_exactness_self_lock", "test_training_m67_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_self_lock", "test_training_m69_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_negative_fixture_self_lock", + "test_training_m70_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_guard_positive_diagnostic_self_lock", "test_training_m53_release_index_doc_category_coverage_is_exact", "test_training_case_product_doc_reflects_current_m40_maturity", ) +TRAINING_M41_RELEASE_INDEX_EXACTNESS_BRIDGE_GUARD_METHODS = ( + "test_training_m65_release_index_source_shape_fixture_guard_methods_constant_inventory_exactness_self_lock", + "test_training_m66_release_index_source_shape_fixture_guard_methods_constant_source_exactness_self_lock", + "test_training_m67_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_self_lock", +) TRAINING_M41_RELEASE_INDEX_SOURCE_SHAPE_FIXTURE_GUARD_METHODS = ( "test_training_m55_release_index_required_snippet_inventory_source_shape_is_locked", "test_training_m56_release_index_required_snippet_inventory_source_shape_rejects_dynamic_fixtures", @@ -622,6 +628,9 @@ class DocumentationConsistencyTests(unittest.TestCase): "required_snippet_inventory_source_shape_fixture_constant_exactness_bridge_duplicate_negative_fixture": ( "test_training_m69_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_negative_fixture_self_lock" ), + "required_snippet_inventory_source_shape_fixture_constant_exactness_bridge_duplicate_guard_positive_diagnostic": ( + "test_training_m70_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_guard_positive_diagnostic_self_lock" + ), "per_doc_helper_exact_category_coverage": ( "test_training_m53_release_index_doc_category_coverage_is_exact" ), @@ -786,6 +795,7 @@ class DocumentationConsistencyTests(unittest.TestCase): "test_training_m66_release_index_source_shape_fixture_guard_methods_constant_source_exactness_self_lock", "test_training_m67_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_self_lock", "test_training_m69_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_negative_fixture_self_lock", + "test_training_m70_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_guard_positive_diagnostic_self_lock", "test_training_m53_release_index_doc_category_coverage_is_exact", "test_training_case_product_doc_reflects_current_m40_maturity", ) @@ -1180,20 +1190,14 @@ class DocumentationConsistencyTests(unittest.TestCase): def test_training_m67_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_self_lock( self, ) -> None: - inventory_exactness_guard = ( - "test_training_m65_release_index_source_shape_fixture_guard_methods_constant_inventory_exactness_self_lock" - ) - source_exactness_guard = ( - "test_training_m66_release_index_source_shape_fixture_guard_methods_constant_source_exactness_self_lock" - ) - guard_name = ( - "test_training_m67_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_self_lock" - ) exactness_bridge_guard_names = ( + TRAINING_M41_RELEASE_INDEX_EXACTNESS_BRIDGE_GUARD_METHODS + ) + ( inventory_exactness_guard, source_exactness_guard, guard_name, - ) + ) = exactness_bridge_guard_names test_case_name = f"{type(self).__module__}.{type(self).__qualname__}" for method_name in exactness_bridge_guard_names: @@ -1233,23 +1237,13 @@ class DocumentationConsistencyTests(unittest.TestCase): def test_training_m69_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_negative_fixture_self_lock( self, ) -> None: - inventory_exactness_guard = ( - "test_training_m65_release_index_source_shape_fixture_guard_methods_constant_inventory_exactness_self_lock" - ) - source_exactness_guard = ( - "test_training_m66_release_index_source_shape_fixture_guard_methods_constant_source_exactness_self_lock" - ) - bridge_exactness_guard = ( - "test_training_m67_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_self_lock" - ) guard_name = ( "test_training_m69_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_negative_fixture_self_lock" ) exactness_bridge_guard_names = ( - inventory_exactness_guard, - source_exactness_guard, - bridge_exactness_guard, + TRAINING_M41_RELEASE_INDEX_EXACTNESS_BRIDGE_GUARD_METHODS ) + bridge_exactness_guard = exactness_bridge_guard_names[-1] synthetic_duplicate_inventory = ( *TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY, bridge_exactness_guard, @@ -1267,6 +1261,48 @@ class DocumentationConsistencyTests(unittest.TestCase): self.assertNotEqual(exact_once_counts, (1, 1, 1)) self.assertEqual(exact_once_counts, (1, 1, 2)) + def test_training_m70_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_guard_positive_diagnostic_self_lock( + self, + ) -> None: + guard_name = ( + "test_training_m70_release_index_source_shape_fixture_guard_methods_constant_inventory_source_exactness_bridge_duplicate_guard_positive_diagnostic_self_lock" + ) + exactness_bridge_guard_names = ( + TRAINING_M41_RELEASE_INDEX_EXACTNESS_BRIDGE_GUARD_METHODS + ) + exact_once_counts = tuple( + TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.count(method_name) + for method_name in exactness_bridge_guard_names + ) + bridge_start = TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.index( + exactness_bridge_guard_names[0] + ) + bridge_indices = tuple( + TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.index(method_name) + for method_name in exactness_bridge_guard_names + ) + test_case_name = f"{type(self).__module__}.{type(self).__qualname__}" + + self.assertIn(guard_name, TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY) + self.assertEqual(exact_once_counts, (1, 1, 1)) + self.assertEqual( + bridge_indices, + tuple(range(bridge_start, bridge_start + len(exactness_bridge_guard_names))), + ) + self.assertEqual( + TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY[ + bridge_start : bridge_start + len(exactness_bridge_guard_names) + ], + exactness_bridge_guard_names, + ) + for method_name in exactness_bridge_guard_names: + with self.subTest(method_name=method_name): + loader = unittest.TestLoader() + suite = loader.loadTestsFromName(f"{test_case_name}.{method_name}") + + self.assertEqual(loader.errors, []) + self.assertEqual(suite.countTestCases(), 1) + def test_training_m47_release_index_per_doc_helper_inventory_self_lock_is_current(self) -> None: helper_name = "_release_index_missing_required_snippets_by_doc" docs_guard_name = "test_training_readmes_expose_m1_m40_release_index_without_raw_test_modules"