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