def test_find_by_id(self): m = Model() m.addPerson("Dave") m.lastPerson.setAttribute("id", "superman") self.assertTrue(m.findPerson(Person.getDotNodeNameFromFullName("Dave")) is not None) self.assertTrue(m.findPerson(Person.getDotNodeNameFromFullName("superman")) is not None) with self.assertRaises(Exception): m.findPerson(Person.getDotNodeNameFromFullName("superted"))
def test_add_and_find_person(self): m = Model() assert len(m.people) == 0 m.addPerson("Dave") assert len(m.people) == 1 with self.assertRaises(Exception): m.findPerson(Person.getDotNodeNameFromFullName("Gwendelina")) assert m.findPerson(Person.getDotNodeNameFromFullName("Dave")) is not None