Strict script-purity tests for name_zh and name_ru
Browse filesReplaces the earlier no-Latin/no-Cyrillic checks with comprehensive tests
that flag any letter character outside the target script (catches Greek,
Arabic, etc., not just Latin/Cyrillic).
Data fix: SKU name_ru contained Greek omicron (U+03BF) where Cyrillic o
(U+043E) was intended ('Скирοс' → 'Скирос').
- test/test_invariants.py +24 -10
test/test_invariants.py
CHANGED
|
@@ -358,18 +358,32 @@ def test_name_zh_no_latin(dataset):
|
|
| 358 |
assert bad == [], f"name_zh with Latin letters: {bad[:10]}"
|
| 359 |
|
| 360 |
|
| 361 |
-
def
|
| 362 |
-
"""name_zh must
|
| 363 |
-
bad = [
|
| 364 |
-
|
| 365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
|
| 367 |
|
| 368 |
-
def
|
| 369 |
-
"""
|
| 370 |
-
bad = [
|
| 371 |
-
|
| 372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
|
| 374 |
|
| 375 |
def test_no_double_spaces_in_names(dataset):
|
|
|
|
| 358 |
assert bad == [], f"name_zh with Latin letters: {bad[:10]}"
|
| 359 |
|
| 360 |
|
| 361 |
+
def test_name_zh_only_cjk_letters(dataset):
|
| 362 |
+
"""All letter characters in name_zh must be CJK (no Latin, Cyrillic, etc.)."""
|
| 363 |
+
bad = []
|
| 364 |
+
for e in dataset:
|
| 365 |
+
v = e.get('name_zh')
|
| 366 |
+
if not v:
|
| 367 |
+
continue
|
| 368 |
+
foreign = [c for c in v if c.isalpha() and not (
|
| 369 |
+
'㐀' <= c <= '鿿' or '豈' <= c <= ''
|
| 370 |
+
)]
|
| 371 |
+
if foreign:
|
| 372 |
+
bad.append((e['code'], v, foreign))
|
| 373 |
+
assert bad == [], f"name_zh with non-CJK letters: {bad[:10]}"
|
| 374 |
|
| 375 |
|
| 376 |
+
def test_name_ru_only_cyrillic_letters(dataset):
|
| 377 |
+
"""All letter characters in name_ru must be Cyrillic."""
|
| 378 |
+
bad = []
|
| 379 |
+
for e in dataset:
|
| 380 |
+
v = e.get('name_ru')
|
| 381 |
+
if not v:
|
| 382 |
+
continue
|
| 383 |
+
foreign = [c for c in v if c.isalpha() and not ('Ѐ' <= c <= 'ӿ')]
|
| 384 |
+
if foreign:
|
| 385 |
+
bad.append((e['code'], v, foreign))
|
| 386 |
+
assert bad == [], f"name_ru with non-Cyrillic letters: {bad[:10]}"
|
| 387 |
|
| 388 |
|
| 389 |
def test_no_double_spaces_in_names(dataset):
|