cterdam commited on
Commit
4a87a3d
·
1 Parent(s): 75d72ba

Add script-purity tests for name_zh and name_ru

Browse files

- test_name_zh_no_cyrillic: no Cyrillic in Chinese name field
- test_name_ru_no_foreign_letters: no Latin or CJK in Russian name field

Data fixes: SBH name_ru 'Густав III' (airport) → 'Сен-Бартелемі';
SPR name_ru 'Джона Грейфа II' (airport) → 'Амбергрис-Кей'

Files changed (1) hide show
  1. test/test_invariants.py +14 -0
test/test_invariants.py CHANGED
@@ -358,6 +358,20 @@ def test_name_zh_no_latin(dataset):
358
  assert bad == [], f"name_zh with Latin letters: {bad[:10]}"
359
 
360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  def test_no_double_spaces_in_names(dataset):
362
  """Name fields must not contain consecutive spaces."""
363
  bad = []
 
358
  assert bad == [], f"name_zh with Latin letters: {bad[:10]}"
359
 
360
 
361
+ def test_name_zh_no_cyrillic(dataset):
362
+ """name_zh must not contain Cyrillic characters."""
363
+ bad = [(e['code'], e['name_zh']) for e in dataset
364
+ if e.get('name_zh') and _has_cyrillic(e['name_zh'])]
365
+ assert bad == [], f"name_zh with Cyrillic: {bad[:10]}"
366
+
367
+
368
+ def test_name_ru_no_foreign_letters(dataset):
369
+ """name_ru must not contain Latin or CJK characters."""
370
+ bad = [(e['code'], e['name_ru']) for e in dataset
371
+ if e.get('name_ru') and re.search(r'[A-Za-z]', e['name_ru'])]
372
+ assert bad == [], f"name_ru with Latin letters: {bad[:10]}"
373
+
374
+
375
  def test_no_double_spaces_in_names(dataset):
376
  """Name fields must not contain consecutive spaces."""
377
  bad = []