def test_single_edge(self): a = [0] b = [1] a.append(b) graph = ObjectGraph([a, b]) self.assertEqual(len(graph), 2) self.assertEqual(graph.references(), [(a, b)])
def test_multiple_edges(self): a = [0] b = [1] a.append(b) a.append(b) graph = ObjectGraph([a, b]) self.assertEqual(graph.references(), [(a, b), (a, b)])
def test_simple_cycle(self): a = [0] b = [1] a.append(b) b.append(a) graph = ObjectGraph([a, b]) self.assertCountEqual(graph.references(), [(a, b), (b, a)])
def test_self_reference(self): a = [0] a.append(a) graph = ObjectGraph([a]) self.assertEqual(graph.references(), [(a, a)])