Exemple #1
0
 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())
Exemple #2
0
    def test_has_payload__for_callable(self):
        vertex = Vertex('vertex_44', DepDag())
        self.assertFalse(vertex.has_payload())

        call_log = list()

        def has_payload_callback():
            call_log.append('CALLED')
            return True

        vertex.payload = has_payload_callback
        self.assertTrue(vertex.has_payload())
        self.assertEqual(['CALLED'], call_log)
Exemple #3
0
 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())
Exemple #4
0
 def test_provide_payload(self):
     vertex = Vertex('vertex_33', VerticesMap(None))
     self.assertFalse(vertex.provided)
     vertex.payload = "any payload would do"
     self.assertTrue(vertex.provided)
Exemple #5
0
 def test_has_payload__for_object(self):
     vertex = Vertex('vertex_33', DepDag())
     self.assertFalse(vertex.has_payload())
     vertex.payload = "any payload would do"
     self.assertTrue(vertex.has_payload())