From aa325f107364877f11edb3d537095885fa4b29e6 Mon Sep 17 00:00:00 2001 From: Titus Date: Mon, 30 Nov 2026 16:22:07 +0100 Subject: [PATCH] Test: the final sigma pair refused, and code point order in the collision rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ς1 beside σ1 is refused, unnamed and as two Bobs (a runtime lowercase keeps them apart). Two Bobs whose ids end alike and begin with U+FF41 and U+1D41A: the U+FF41 one keeps the short name, where a UTF-16 sort gives it to the other. case-collide.cases.json: 16 refused, 10 written, the same bytes in both packages. Co-Authored-By: Claude Opus 5.5 --- tests/fixtures/case-collide.cases.json | 48 ++++++++++++++++++++++++++ tests/test_case_collide.py | 6 ++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/case-collide.cases.json b/tests/fixtures/case-collide.cases.json index 5c6c690..b14c1fe 100644 --- a/tests/fixtures/case-collide.cases.json +++ b/tests/fixtures/case-collide.cases.json @@ -211,6 +211,36 @@ } ], "message": "character element ids \"é1\" and \"é1\" give the file names \"bob--é1.json\" and \"bob--é1.json\", which are one name once folded (NFC, then simple case folding), so a case-insensitive disk (NTFS, APFS) may keep one file for both." + }, + { + "elements": [ + { + "type": "character", + "id": "ς1", + "name": "" + }, + { + "type": "character", + "id": "σ1", + "name": "" + } + ], + "message": "character element ids \"ς1\" and \"σ1\" give the file names \"ς1.json\" and \"σ1.json\", which are one name once folded (NFC, then simple case folding), so a case-insensitive disk (NTFS, APFS) may keep one file for both." + }, + { + "elements": [ + { + "type": "character", + "id": "ς1", + "name": "Bob" + }, + { + "type": "character", + "id": "σ1", + "name": "Bob" + } + ], + "message": "character element ids \"ς1\" and \"σ1\" give the file names \"bob--ς1.json\" and \"bob--σ1.json\", which are one name once folded (NFC, then simple case folding), so a case-insensitive disk (NTFS, APFS) may keep one file for both." } ], "written": [ @@ -375,6 +405,24 @@ "elements/character/bob--1234567K.json", "elements/character/bob--b1234567k.json" ] + }, + { + "elements": [ + { + "type": "character", + "id": "𝐚-12345678", + "name": "Bob" + }, + { + "type": "character", + "id": "a-12345678", + "name": "Bob" + } + ], + "paths": [ + "elements/character/bob--12345678.json", + "elements/character/bob--𝐚-12345678.json" + ] } ] } diff --git a/tests/test_case_collide.py b/tests/test_case_collide.py index c8a1698..c2b1878 100644 --- a/tests/test_case_collide.py +++ b/tests/test_case_collide.py @@ -19,7 +19,7 @@ from onlyworlds import write_folder FIXTURE = Path(__file__).resolve().parent / "fixtures" / "case-collide.cases.json" -FIXTURE_SHA256 = "7fec915c2207aa654c01587076883fbdd693dc9f2c5e604733360573ff838b12" +FIXTURE_SHA256 = "6458bd08ad90de5dbc8c2f1fd4c52dca415cdd04bdd646555f4a00c787d0fd48" W = {"id": "w-1", "name": "W"} @@ -47,8 +47,8 @@ def test_the_cases_file_is_the_pinned_bytes() -> None: assert hashlib.sha256(FIXTURE.read_bytes()).hexdigest() == FIXTURE_SHA256 data = _data() assert data["version"] == 1 - assert len(data["refused"]) == 14 - assert len(data["written"]) == 9 + assert len(data["refused"]) == 16 + assert len(data["written"]) == 10 @pytest.mark.parametrize("reverse", [False, True], ids=["given", "reversed"])