예제 #1
0
    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"))
예제 #2
0
    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