Beispiel #1
0
    def test_undirected_vertex_has_attr(self):
        """ Check if a directed vertex has a particular attribute """
        v0 = DirectedVertex(val='v0', attrs={'city': 'Modena', 0: 1})

        self.assertTrue(v0.has_attr('city'))
        self.assertFalse(v0.has_attr('town'))

        v0.del_attr('city')

        self.assertFalse(v0.has_attr('city'))
Beispiel #2
0
    def test_directed_vertex_del_attr(self):
        """ Delete an attribute of a directed vertex """
        v0 = DirectedVertex(val='v0', attrs={'city': 'Modena', 0: 1})

        v0.del_attr('city')

        self.assertEqual(v0.attrs, {0: 1})

        v0.del_attr(0)

        self.assertEqual(v0.attrs, {})