Ejemplo n.º 1
0
def test_constructor_with_empty_string_full_name():
    person = Person("")
    assert person._full_name is None
Ejemplo n.º 2
0
def person():
    return Person("Firstname Lastname")
Ejemplo n.º 3
0
def test_less_than_when_false(person):
    a = Person("a")
    b = Person("b")
    assert not (b < a)
Ejemplo n.º 4
0
def test_hash_changes(person):
    other = Person("123")
    assert hash(person) != hash(other)
Ejemplo n.º 5
0
def test_constructor():
    person = Person("123")
    assert person._full_name == "123"
Ejemplo n.º 6
0
def test_less_than_when_true(person):
    a = Person("a")
    b = Person("b")
    assert a < b
Ejemplo n.º 7
0
def test_equality_when_not_equal(person):
    other = Person("Firstname2 Lastname2")
    assert person != other
Ejemplo n.º 8
0
def test_equality_when_equal(person):
    other = Person("Firstname Lastname")
    assert person == other
Ejemplo n.º 9
0
def test_repr_with_no_name():
    person = Person("")
    assert repr(person) == "<Person None>"
Ejemplo n.º 10
0
def test_constructor_strips_whitespace():
    person = Person("        Firstname Lastname      ")
    assert person._full_name == "Firstname Lastname"
Ejemplo n.º 11
0
def test_constructor_with_non_string_full_name():
    person = Person(42)
    assert person._full_name is None