def test_unordered_flow_provides_required_values(self): flow = uf.Flow('uf') flow.add(utils.TaskOneReturn('task1', provides='x'), utils.TaskOneArg('task2')) flow.add(utils.TaskOneReturn('task1', provides='x'), utils.TaskOneArg('task2')) self.assertEqual(set(['x']), flow.provides) self.assertEqual(set(['x']), flow.requires)
def test_linear_flow_provides_required_values(self): flow = lf.Flow('lf').add(utils.TaskOneReturn('task1', provides='x'), utils.TaskOneArg('task2')) self.assertEquals(flow.requires, set()) self.assertEquals(flow.provides, set(['x']))
def test_linear_flow_provides_out_of_order(self): with self.assertRaises(exceptions.InvariantViolationException): lf.Flow('lf').add(utils.TaskOneArg('task2'), utils.TaskOneReturn('task1', provides='x'))
def test_linear_flow_reuires_rebind_values(self): flow = lf.Flow('lf').add(utils.TaskOneArg('task1', rebind=['q']), utils.TaskMultiArg('task2')) self.assertEquals(flow.requires, set(['x', 'y', 'z', 'q'])) self.assertEquals(flow.provides, set())
def test_graph_flow_reuires_values(self): flow = gf.Flow('gf').add(utils.TaskOneArg('task1'), utils.TaskMultiArg('task2')) self.assertEquals(flow.requires, set(['x', 'y', 'z'])) self.assertEquals(flow.provides, set())
def test_unordered_flow_provides_required_value_other_call(self): flow = uf.Flow('uf') flow.add(utils.TaskOneArg('task2')) with self.assertRaises(exceptions.InvariantViolationException): flow.add(utils.TaskOneReturn('task1', provides='x'))
def test_unordered_flow_provides_required_values(self): flow = uf.Flow('uf') self.assertRaises(exceptions.InvariantViolation, flow.add, utils.TaskOneReturn('task1', provides='x'), utils.TaskOneArg('task2'))
def test_unordered_flow_requires_rebind_values(self): flow = uf.Flow('uf').add(utils.TaskOneArg('task1', rebind=['q']), utils.TaskMultiArg('task2')) self.assertEqual(flow.requires, set(['x', 'y', 'z', 'q'])) self.assertEqual(flow.provides, set())
def test_bad_rebind_args_value(self): with self.assertRaises(TypeError): utils.TaskOneArg(rebind=object())
def test_linear_flow_requires_values(self): flow = lf.Flow('lf').add(utils.TaskOneArg('task1'), utils.TaskMultiArg('task2')) self.assertEqual(set(['x', 'y', 'z']), flow.requires) self.assertEqual(set(), flow.provides)
def test_graph_flow_provides_required_values(self): flow = gf.Flow('gf').add(utils.TaskOneReturn('task1', provides='x'), utils.TaskOneArg('task2')) self.assertEqual(set(), flow.requires) self.assertEqual(set(['x']), flow.provides)
def test_graph_flow_requires_rebind_values(self): flow = gf.Flow('gf').add(utils.TaskOneArg('task1', rebind=['q']), utils.TaskMultiArg('task2')) self.assertEqual(set(['x', 'y', 'z', 'q']), flow.requires) self.assertEqual(set(), flow.provides)