Ejemplo n.º 1
0
def test_eq_instances_not_equal():
    p1 = Person("John", None, "Adams")
    p2 = Person("John", "Quincy", "Adams")

    assert p1 != p2  # calls Person.__ne__()
Ejemplo n.º 2
0
def test_eq_new_instances_equal_fail():
    p1 = Person(None, None, None)
    p2 = Person(None, None, None)

    assert p1 != p2  # calls Person.__eq__()
Ejemplo n.º 3
0
def test_eq_instances_equal():
    p1 = Person("John", "Quincy", "Adams")
    p2 = Person("John", "Quincy", "Adams")

    assert p1 == p2  # calls Person.__eq__()
Ejemplo n.º 4
0
def test_init():
    person = Person("John", "Quincy", "Adams")

    assert ("John", "Quincy", "Adams") == \
           (person.first_name, person.middle_name, person.last_name)
Ejemplo n.º 5
0
 def test_eq_new_instances_equal(self):
     p1 = Person(None, None, None)
     p2 = Person(None, None, None)
     self.assertEqual(p1, p2)  # assertEqual() calls p1.__eq__(p2)
Ejemplo n.º 6
0
 def test_eq_instances_not_equal(self):
     p1 = Person("John", None, "Adams")
     p2 = Person("John", "Quincy", "Adams")
     self.assertTrue(p1 != p2)
Ejemplo n.º 7
0
    def test_init(self):
        person = Person("John", "Quincy", "Adams")

        self.assertEqual("John", person.first_name)
        self.assertEqual("Quincy", person.middle_name)
        self.assertEqual("Adams", person.last_name)