def testdata():
    data = []
    tobi = Person(
        name='Tobi',
        number=1,
        email='*****@*****.**',
        phone='0123456789',
        marked_numbers={2, 3, 4},
    )
    sara = Person(
        name='Sara Mustermann',
        number=2,
        email='',
        phone='123456789',
        marked_numbers={1, 4, 3},
    )
    mark = Person(
        name='Mark',
        number=3,
        email='*****@*****.**',
        phone='987654321',
        marked_numbers={2, 5, 1},
    )
    luisa = Person(name='Luisa',
                   number=4,
                   email='',
                   phone='49123456789',
                   marked_numbers={5, 1})
    data.append(tobi)
    data.append(sara)
    data.append(mark)
    data.append(luisa)
    return data
예제 #2
0
def test_passing_valid_flag_works():
    person = Person(
        name='Deere',
        number=10,
        phone='911',
        flags=MatchingFlags.match_all,
        marked_numbers=set(),
    )

    assert MatchingFlags.match_all in person.flags
예제 #3
0
def test_passing_non_flag_to_flags_raises_error():
    try:
        Person(name='Samuel',
               number=20,
               phone='123',
               flags=None,
               marked_numbers=set())
        assert False, 'should not accept flags'
    except TypeError:
        assert True
def testdata():
    data = []
    tobi = Person(
        name='Tobi',
        number=1,
        email='*****@*****.**',
        phone='0123456789',
        marked_numbers=set(),
        flags=MatchingFlags.match_all,
    )
    sara = Person(
        name='Sara Mustermann',
        number=2,
        email='',
        phone='123456789',
        marked_numbers=set(),
        flags=MatchingFlags.match_all,
    )
    mark = Person(
        name='Mark',
        number=3,
        email='*****@*****.**',
        phone='0987654321',
        marked_numbers=set(),
    )
    luisa = Person(
        name='Luisa',
        number=4,
        email='',
        phone='0049123456789',
        marked_numbers=set(),
        flags=MatchingFlags.match_all,
    )
    tobi.results.add_marked_by_me(mark)
    tobi.results.add_marked_by_me(luisa)
    tobi.results.add_marked_me(sara)
    data.append(tobi)
    data.append(sara)
    data.append(mark)
    data.append(luisa)
    return data
예제 #5
0
def test_if_person_has_no_name_or_phone_do_not_raise_error():
    try:
        Person(name='Joe', number=14, marked_numbers=set())
        assert True
    except RuntimeError:
        assert False
예제 #6
0
def test_passing_something_other_than_set_as_marked_numbers_raises_error():
    try:
        Person(name='Foo', number=1, phone='123457', marked_numbers=[1, 2, 3])
        assert False
    except TypeError:
        assert True