From 2e1461cb6b8405e77373df876f2ea61a52a5a32a Mon Sep 17 00:00:00 2001 From: hshalwhabi-cpu Date: Fri, 21 Aug 2026 03:04:04 +0300 Subject: [PATCH] Add test coverage for paths.nfc() nfc() normalizes path strings to NFC to prevent macOS NFD filenames from mismatching NFC entries in manifests/graphs (#2210, #2221/#2224), but had no direct test asserting its behavior. --- tests/test_paths.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_paths.py b/tests/test_paths.py index 12359006fb..31d9d3d2d5 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -7,6 +7,7 @@ from graphify.paths import ( _is_test_path, disambiguate_ambiguous_candidates, + nfc, ) @@ -144,3 +145,15 @@ def test_is_absolute_any_platform_is_host_independent(): from graphify.paths import is_absolute_any_platform assert is_absolute_any_platform("/home/ci/x.md") assert is_absolute_any_platform("C:/Users/u/x.md") + + +# --- NFC normalization for cross-platform path identity --------------------- +# macOS reports filenames in NFD; manifests and graph source_file entries are +# typically NFC. Path membership checks that skip normalization treat the same +# file as two different paths (#2210, #2221/#2224). + +def test_nfc_normalizes_decomposed_unicode() -> None: + decomposed = "e\u0301" # "e" + combining acute accent (NFD form) + composed = "\u00e9" # "é" precomposed (NFC form) + assert nfc(decomposed) == composed + assert nfc(composed) == composed # already-NFC input is a no-op