예제 #1
0
def test_sex_female():
    p = Person("female")
    assert p.sex == "female"
    global spy_job_was_called
    spy_job_was_called = False
    p.do_job_based_on_sex(dummy_job, spy_job)
    assert spy_job_was_called
예제 #2
0
def cast_to_persons(list_of_names) -> set:
    persons = set()
    for name in list_of_names:
        if name in women_names:
            persons.add(Person("female", name))
        else:
            persons.add(Person("male", name))
    return persons
def test_incorrect_R_relations(dummy):
    impossible_father_in_law = Person(sex="female")
    assert not impossible_father_in_law.can_be_father_in_law_of(dummy)
    father_in_law = Person(sex="male")
    impossible_son_in_law = Person(sex="female")
    assert not father_in_law.can_be_father_in_law_of(impossible_son_in_law)
    assert not father_in_law.can_be_father_in_law_of(father_in_law)
def index_person_advanced(person: Person, out_cached_index):
    if person is None:
        raise ValueError()

    if person.name in out_cached_index:
        return out_cached_index.index(person.name) + 1
    else:
        out_cached_index.append(person.name)
        person.id = len(out_cached_index)
        return person.id
def test_correct_R_relations():
    father_in_law = Person(sex="male")
    son_in_law = Person(sex="male")
    assert father_in_law.can_be_father_in_law_of(son_in_law)
예제 #6
0
def left_handed():
    return Person("male")
예제 #7
0
def test_sex_male():
    p = Person("male")
    assert p.sex == "male"
    p.do_job_based_on_sex(spy_job, dummy_job)
    assert spy_job_was_called == True
예제 #8
0
def female3():
    return Person("female", "Female3")
예제 #9
0
def righhanders():
    return {Person("male"), Person("female"), Person("male"), Person("male")}
예제 #10
0
def female1():
    return Person("female", "Female1")
예제 #11
0
def female2():
    return Person("female", "Female2")
예제 #12
0
def female():
    return Person("female", "Female")
예제 #13
0
def male3():
    return Person("male", "Male3")
예제 #14
0
def male2():
    return Person("male", "Male2")
예제 #15
0
def male1():
    return Person("male", "Male1")
예제 #16
0
def male():
    return Person("male", "Male")