Skip to content

Commit 9825cfa

Browse files
fix(tests): remove dead branch in test_nfkc_normalization_detected
The 'if original != normalized' guard was always True for fullwidth ASCII (abc always maps to abc under NFKC), making the False branch unreachable and dropping overall branch coverage below the required 100%.
1 parent 3347e69 commit 9825cfa

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

tests/shared/test_tool_name_validation.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,17 @@ def test_decomposed_unicode_detected(self) -> None:
297297
)
298298

299299
def test_nfkc_normalization_detected(self) -> None:
300-
"""NFKC normalization changes should be detected."""
301-
import unicodedata
302-
303-
# Fullwidth characters normalize differently in NFKC
304-
original = "abc" # Fullwidth ASCII
305-
normalized = unicodedata.normalize("NFKC", original)
300+
"""NFKC normalization changes should be detected.
306301
302+
Fullwidth ASCII (e.g. abc) always normalizes under NFKC, so the
303+
validator must flag it unconditionally.
304+
"""
305+
# Fullwidth characters always normalize to ASCII under NFKC
306+
original = "abc" # Fullwidth ASCII — NFKC maps these to 'abc'
307307
result = validate_tool_name(original)
308-
# Should detect that normalization would change this
309-
if original != normalized:
310-
assert not result.is_valid or any("normalize" in w.lower() for w in result.warnings), (
311-
"NFKC normalization should be detected"
312-
)
308+
assert not result.is_valid or any("normalize" in w.lower() for w in result.warnings), (
309+
"NFKC normalization should be detected"
310+
)
313311

314312

315313
class TestUnicodeBoundaryConditions:

0 commit comments

Comments
 (0)