def test_all_supporters(self): vmap = VerticesMap(None) a = Vertex('a', vmap) a.depends_on('b') b = vmap['b'] b.depends_on('c') self.assertEqual(['b', 'c'], a.supporters(recurse=True))
def test_all_supporters(self): dag = DepDag() a = Vertex('a', dag) a.depends_on('b') b = dag['b'] b.depends_on('c') self.assertEqual(['b', 'c'], names_list(a.all_supporters()))
def test_depends_on__test_supporters(self): vtx = Vertex('vertex_0', VerticesMap(None)) vtx.depends_on('vertex_1', 'vertex_2') expected = ['vertex_1', 'vertex_2'] self.assertEqual(expected, vtx.supporters(recurse=False)) vtx.depends_on('vertex_2', 'vertex_3') expected = ['vertex_1', 'vertex_2', 'vertex_3'] self.assertEqual(expected, vtx.supporters(recurse=False))
def test_depends_on__test_supporters(self): vertex = Vertex('vertex_0', DepDag()) vertex.depends_on('vertex_1', 'vertex_2') expected = ['vertex_1', 'vertex_2'] self.assertEqual(expected, names_list(vertex.direct_supporters())) vertex.depends_on('vertex_2', 'vertex_3') expected = ['vertex_1', 'vertex_2', 'vertex_3'] self.assertEqual(expected, names_list(vertex.direct_supporters()))
def test_is_resolved__simplest_case(self): vmap = VerticesMap(None) a = Vertex('a', vmap) a.depends_on('b') self.assertFalse(a.is_resolved()) b = vmap['b'] self.assertFalse(b.is_resolved()) b.payload = 'payload for vert-b' self.assertFalse(a.is_resolved()) self.assertTrue(b.is_resolved()) a.payload = 'payload for vert-a' self.assertTrue(a.is_resolved()) self.assertTrue(b.is_resolved())
def test_is_resolved__simplest_case(self): dag = DepDag() a = Vertex('a', dag) a.depends_on('b') self.assertFalse(a.is_resolved()) b = dag['b'] self.assertFalse(b.is_resolved()) b.payload = 'payload for vert-b' self.assertFalse(a.is_resolved()) self.assertTrue(b.is_resolved()) a.payload = 'payload for vert-a' self.assertTrue(a.is_resolved()) self.assertTrue(b.is_resolved())