Spaces:
Runtime error
Runtime error
File size: 1,679 Bytes
6295a87 6349813 fbc21be 4f16d99 fbc21be 6349813 fbc21be 6349813 fbc21be 6349813 fbc21be 6349813 6295a87 99d6492 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
from maorganizer.datawrangling import Attendancelist, Person
def test_attendancelist_finds_person_by_substring():
assert Attendancelist(
{Person("zaphod beeblebrox"), Person("ford prefix")}
).find_by_string("aph") == {Person("Zaphod Beeblebrox")}
def test_attendancelist_finds_person_by_namepart():
assert Attendancelist(
{Person("zaphod beeblebrox"), Person("ford prefix")}
).find_person(Person("zaphod")) == {Person("Zaphod Beeblebrox")}
def test_attendancelists_finds_multiple_people_if_existent():
assert Attendancelist(
{Person("zaphod beeblebrox"), Person("zaphod prefix"), Person("ford prefix")}
).find_person(Person("zaphod")) == {
Person("Zaphod Beeblebrox"),
Person("Zaphod Prefix"),
}
def test_find_people_finds_alls():
assert Attendancelist(
{Person("zaphod beeblebrox"), Person("ford prefix"), Person("Marvin")}
).find_people({Person("zaphod"), Person("ford prefix")}) == {
Person(name="Ford Prefix"): {Person(name="Ford Prefix")},
Person(name="Zaphod"): {Person(name="Zaphod Beeblebrox")},
}
def test_attendance_list_updates_correctly():
assert Attendancelist({Person("zaphod beeblebrox"), Person("ford prefix")}).update(
Attendancelist(
{
Person("zaphod beeblebrox"),
Person("ford prefix"),
Person("lord crawfish"),
}
)
) == Attendancelist(participants={Person("lord crawfish")})
def test_attendancelist_has_correct_n_attendees():
assert (
Attendancelist({Person("zaphod beeblebrox"), Person("ford prefix")}).n_attendees
== 2
)
|