generated from john/python-template
V4.1 Mostly UI adjustments by GC
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from datetime import date
|
||||
|
||||
from transcription.db.models import Person
|
||||
from transcription.ui.components.formatters import compact_date
|
||||
from transcription.ui.components.formatters import family_search_url
|
||||
from transcription.ui.components.formatters import person_selector_label
|
||||
|
||||
|
||||
def test_compact_date_prefers_exact_then_approximate_then_unknown():
|
||||
assert compact_date(date(1924, 3, 2), "about 1924") == "1924-03-02"
|
||||
assert compact_date(None, "about 1924") == "about 1924"
|
||||
assert compact_date(None, " ") == "Unknown"
|
||||
|
||||
|
||||
def test_person_selector_label_disambiguates_without_changing_identity():
|
||||
person = Person(
|
||||
full_name="Albert Edward Higgins",
|
||||
display_name="Hig",
|
||||
birth_date=date(1885, 1, 2),
|
||||
)
|
||||
assert person_selector_label(person) == "Hig - Albert Edward Higgins (1885)"
|
||||
|
||||
approximate = Person(
|
||||
full_name="Albert Edward Higgins",
|
||||
display_name="Hig",
|
||||
birth_date_raw="about 1912",
|
||||
)
|
||||
assert person_selector_label(approximate) == "Hig - Albert Edward Higgins (1912)"
|
||||
|
||||
|
||||
def test_family_search_url_uses_fixed_person_details_route():
|
||||
assert family_search_url("G8T4-MDQ") == (
|
||||
"https://www.familysearch.org/tree/person/details/G8T4-MDQ"
|
||||
)
|
||||
Reference in New Issue
Block a user