Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion toolchain/mfc/params_tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,21 @@ def test_family_attr_typo_gives_targeted_error(self):
errors = check_unknown_params(params)
self.assertEqual(len(errors), 1)
self.assertIn("Valid attributes", errors[0])
self.assertIn("geometry", errors[0])
self.assertNotIn("Did you mean", errors[0])

@unittest.skipUnless(RAPIDFUZZ_AVAILABLE, "rapidfuzz not installed")
def test_family_attr_typo_lists_intended_attr_first(self):
"""The intended attribute must survive truncation of the valid-attribute list.

Comment on lines +91 to +93
_family_attr_error orders by similarity before truncating at 8, so this only
holds when rapidfuzz is installed; without it the list is plain alphabetical
and patch_ib's 26 attributes push 'geometry' past the cut.
"""
params = {"patch_ib(1)%geometri": 1}
errors = check_unknown_params(params)
self.assertEqual(len(errors), 1)
self.assertIn("geometry", errors[0])

def test_family_valid_attr_no_error(self):
"""Valid family param should not generate an error."""
params = {"patch_ib(1)%geometry": 1}
Expand Down
Loading