def test_can_modify_contact_name(self): contact = Contact("Marvin Goodwright") contact.name("Albus Dumbledore") self.assertEqual(contact._name, "Albus Dumbledore")
def test_can_only_set_contact_name_to_str(self): contact = Contact("Marvin Goodwright") with self.assertRaises(TypeError): contact.name(123)
def test_contact_name_property(self): contact = Contact("Marvin Goodwright") self.assertIs(contact._name, contact.name())