feat(normalizer): person register parsing
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
29
tools/import-normalizer/tests/test_persons.py
Normal file
29
tools/import-normalizer/tests/test_persons.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import persons
|
||||
|
||||
def test_slugify():
|
||||
assert persons.slugify("de Gruyter", "Eugenie") == "de-gruyter-eugenie"
|
||||
assert persons.slugify("Müller", "Karl Erhard") == "mueller-karl-erhard"
|
||||
|
||||
def test_parse_register_basic():
|
||||
rows = [
|
||||
{"generation": "G 1", "last_name": "Blomquist", "first_name": "Charlotte,Meta,Jacobi",
|
||||
"maiden_name": "Ruge", "birth_date": "30.8.1862", "birth_place": "Schülperneusiel",
|
||||
"death_date": "1934-07-23", "death_place": "Göteborg", "spouse": '"Tante Lolly"',
|
||||
"notes": "Schwester v Marie Cram"},
|
||||
{"generation": "G 2", "last_name": "Bohrmann", "first_name": "Else",
|
||||
"maiden_name": "Cram", "birth_date": "28.11.1888", "spouse": "Ludwig Bohrmann",
|
||||
"notes": "Schwester v Herbert"},
|
||||
]
|
||||
people = persons.parse_register(rows)
|
||||
p = people[0]
|
||||
assert p.person_id == "blomquist-charlotte"
|
||||
assert p.first_name == "Charlotte"
|
||||
assert p.maiden_name == "Ruge"
|
||||
assert p.birth_date == "1862-08-30"
|
||||
assert p.nickname == "Tante Lolly" # quoted spouse field is a nickname, not a spouse
|
||||
assert p.spouse == ""
|
||||
assert "Meta" in p.extra_given_names and "Jacobi" in p.extra_given_names
|
||||
p2 = people[1]
|
||||
assert p2.maiden_name == "Cram"
|
||||
assert p2.spouse == "Ludwig Bohrmann"
|
||||
assert p2.provisional is False
|
||||
Reference in New Issue
Block a user