-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
351e313
commit 32a53a5
Showing
2 changed files
with
24 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
def test_person_names(person_unnamed, person_single_name, person_multiple_names): | ||
from person.models import PersonDateOfBirth, PersonName | ||
|
||
assert person_unnamed.__str__().startswith("Unknown person #") | ||
assert person_single_name.__str__() == "Bert" | ||
assert person_multiple_names.__str__() == "Bert (aka Ernie, Oscar)" | ||
|
||
def test_person_name_for_unnamed_person(person): | ||
assert person.__str__().startswith("Unknown person #") | ||
|
||
def test_person_date_of_birth(person_with_exact_dob, person_with_approx_dob): | ||
assert person_with_exact_dob.date_of_birth.__str__().endswith("born in 512") | ||
assert person_with_approx_dob.date_of_birth.__str__().endswith("born c. 500–525") | ||
|
||
def test_person_name_for_person_with_single_name(person): | ||
PersonName.objects.create(person=person, value="Bert") | ||
assert person.__str__() == "Bert" | ||
|
||
|
||
def test_person_name_for_person_with_multiple_names(person): | ||
PersonName.objects.create(person=person, value="Bert") | ||
PersonName.objects.create(person=person, value="Ernie") | ||
PersonName.objects.create(person=person, value="Oscar") | ||
assert person.__str__() == "Bert (aka Ernie, Oscar)" | ||
|
||
|
||
def test_person_with_exact_date_of_birth(person): | ||
PersonDateOfBirth.objects.create(person=person, year_exact=512) | ||
assert person.date_of_birth.__str__().endswith("born in 512") | ||
|
||
|
||
def test_person_with_approx_date_of_birth(person): | ||
PersonDateOfBirth.objects.create(person=person, year_lower=500, year_upper=525) | ||
assert person.date_of_birth.__str__().endswith("born c. 500–525") |