Skip to content

Commit b034a16

Browse files
fix(tests): apply ruff-format to assert statements in homoglyph tests
Reformats four multiline assert-with-message statements to the inline style required by ruff-format, fixing the pre-commit CI failure. No logic changes — test semantics are identical. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ab67038 commit b034a16

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

tests/shared/test_tool_name_validation.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ def test_cyrillic_a_rejected(self) -> None:
233233
"""
234234
result = validate_tool_name("tool_А")
235235
assert not result.is_valid, "Cyrillic А should be rejected"
236-
assert any(
237-
"invalid characters" in w.lower() for w in result.warnings
238-
), f"Expected invalid-character warning. Got: {result.warnings}"
236+
assert any("invalid characters" in w.lower() for w in result.warnings), (
237+
f"Expected invalid-character warning. Got: {result.warnings}"
238+
)
239239

240240
def test_cyrillic_o_rejected(self) -> None:
241241
"""Cyrillic О (U+041E) looks identical to Latin O."""
@@ -271,10 +271,9 @@ def test_rtl_override_rejected(self) -> None:
271271
"""Right-to-left override character (U+202E) should be rejected."""
272272
result = validate_tool_name("tool‮_name") # RIGHT-TO-LEFT OVERRIDE
273273
assert not result.is_valid
274-
assert any(
275-
"directional" in w.lower() or "rtl" in w.lower()
276-
for w in result.warnings
277-
), f"Warning should mention directional formatting. Got: {result.warnings}"
274+
assert any("directional" in w.lower() or "rtl" in w.lower() for w in result.warnings), (
275+
f"Warning should mention directional formatting. Got: {result.warnings}"
276+
)
278277

279278
def test_ltr_override_rejected(self) -> None:
280279
"""Left-to-right override character (U+202D) should be rejected."""
@@ -293,10 +292,9 @@ def test_decomposed_unicode_detected(self) -> None:
293292
decomposed = unicodedata.normalize("NFD", "café")
294293
result = validate_tool_name(f"tool_{decomposed}")
295294
# Should either be rejected or warn
296-
assert (
297-
not result.is_valid
298-
or any("normalize" in w.lower() for w in result.warnings)
299-
), f"Decomposed forms should be detected. Got is_valid={result.is_valid}, warnings={result.warnings}"
295+
assert not result.is_valid or any("normalize" in w.lower() for w in result.warnings), (
296+
f"Decomposed forms should be detected. Got is_valid={result.is_valid}, warnings={result.warnings}"
297+
)
300298

301299
def test_nfkc_normalization_detected(self) -> None:
302300
"""NFKC normalization changes should be detected."""
@@ -309,10 +307,9 @@ def test_nfkc_normalization_detected(self) -> None:
309307
result = validate_tool_name(original)
310308
# Should detect that normalization would change this
311309
if original != normalized:
312-
assert (
313-
not result.is_valid
314-
or any("normalize" in w.lower() for w in result.warnings)
315-
), "NFKC normalization should be detected"
310+
assert not result.is_valid or any("normalize" in w.lower() for w in result.warnings), (
311+
"NFKC normalization should be detected"
312+
)
316313

317314

318315
class TestUnicodeBoundaryConditions:

0 commit comments

Comments
 (0)