<s> from taskflow import exceptions <EOL> from taskflow . patterns import graph_flow as gf <EOL> from taskflow . patterns import linear_flow as lf <EOL> from taskflow . patterns import unordered_flow as uf <EOL> from taskflow import retry <EOL> from taskflow import test <EOL> from taskflow . tests import utils <EOL> class FlowDependenciesTest ( test . TestCase ) : <EOL> def test_task_without_dependencies ( self ) : <EOL> flow = utils . TaskNoRequiresNoReturns ( ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_task_requires_default_values ( self ) : <EOL> flow = utils . TaskMultiArg ( ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides , ) <EOL> def test_task_requires_rebinded_mapped ( self ) : <EOL> flow = utils . TaskMultiArg ( rebind = { '<STR_LIT:x>' : '<STR_LIT:a>' , '<STR_LIT:y>' : '<STR_LIT:b>' , '<STR_LIT:z>' : '<STR_LIT:c>' } ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_task_requires_additional_values ( self ) : <EOL> flow = utils . TaskMultiArg ( requires = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_task_provides_values ( self ) : <EOL> flow = utils . TaskMultiReturn ( provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . provides ) <EOL> def test_task_provides_and_requires_values ( self ) : <EOL> flow = utils . TaskMultiArgMultiReturn ( provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . provides ) <EOL> def test_linear_flow_without_dependencies ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskNoRequiresNoReturns ( '<STR_LIT>' ) , <EOL> utils . TaskNoRequiresNoReturns ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_linear_flow_requires_values ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArg ( '<STR_LIT>' ) , <EOL> utils . TaskMultiArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_linear_flow_requires_rebind_values ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArg ( '<STR_LIT>' , rebind = [ '<STR_LIT:q>' ] ) , <EOL> utils . TaskMultiArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' , '<STR_LIT:q>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_linear_flow_provides_values ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskMultiReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . provides ) <EOL> def test_linear_flow_provides_required_values ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskOneArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_linear_flow_multi_provides_and_requires_values ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskMultiArgMultiReturn ( '<STR_LIT>' , <EOL> rebind = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:q>' ] ) , <EOL> utils . TaskMultiArgMultiReturn ( '<STR_LIT>' , <EOL> provides = [ '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT:k>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:q>' , '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT:k>' ] ) , flow . provides ) <EOL> def test_unordered_flow_without_dependencies ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskNoRequiresNoReturns ( '<STR_LIT>' ) , <EOL> utils . TaskNoRequiresNoReturns ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_unordered_flow_requires_values ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArg ( '<STR_LIT>' ) , <EOL> utils . TaskMultiArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_unordered_flow_requires_rebind_values ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArg ( '<STR_LIT>' , rebind = [ '<STR_LIT:q>' ] ) , <EOL> utils . TaskMultiArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' , '<STR_LIT:q>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_unordered_flow_provides_values ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskMultiReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . provides ) <EOL> def test_unordered_flow_provides_required_values ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskOneArg ( '<STR_LIT>' ) ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskOneArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . requires ) <EOL> def test_unordered_flow_requires_provided_value_other_call ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) ) <EOL> flow . add ( utils . TaskOneArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . requires ) <EOL> def test_unordered_flow_provides_required_value_other_call ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) <EOL> flow . add ( utils . TaskOneArg ( '<STR_LIT>' ) ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( flow ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . requires ) <EOL> def test_unordered_flow_multi_provides_and_requires_values ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskMultiArgMultiReturn ( '<STR_LIT>' , <EOL> rebind = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:d>' , '<STR_LIT:e>' , '<STR_LIT:f>' ] ) , <EOL> utils . TaskMultiArgMultiReturn ( '<STR_LIT>' , <EOL> provides = [ '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT:k>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' , '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:d>' , '<STR_LIT:e>' , '<STR_LIT:f>' , '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT:k>' ] ) , flow . provides ) <EOL> def test_unordered_flow_provides_same_values ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( utils . TaskOneReturn ( provides = '<STR_LIT:x>' ) ) <EOL> flow . add ( utils . TaskOneReturn ( provides = '<STR_LIT:x>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_unordered_flow_provides_same_values_one_add ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) <EOL> flow . add ( utils . TaskOneReturn ( provides = '<STR_LIT:x>' ) , <EOL> utils . TaskOneReturn ( provides = '<STR_LIT:x>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_nested_flows_requirements ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' ) . add ( <EOL> lf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArgOneReturn ( '<STR_LIT>' , <EOL> rebind = [ '<STR_LIT:a>' ] , provides = [ '<STR_LIT:x>' ] ) , <EOL> utils . TaskOneArgOneReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:y>' ] ) ) , <EOL> uf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArgOneReturn ( '<STR_LIT>' , <EOL> rebind = [ '<STR_LIT:b>' ] , provides = [ '<STR_LIT:z>' ] ) , <EOL> utils . TaskOneArgOneReturn ( '<STR_LIT>' , rebind = [ '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:q>' ] ) ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' , '<STR_LIT:q>' ] ) , flow . provides ) <EOL> def test_graph_flow_requires_values ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArg ( '<STR_LIT>' ) , <EOL> utils . TaskMultiArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_graph_flow_requires_rebind_values ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneArg ( '<STR_LIT>' , rebind = [ '<STR_LIT:q>' ] ) , <EOL> utils . TaskMultiArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' , '<STR_LIT:q>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_graph_flow_provides_values ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskMultiReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] ) , flow . provides ) <EOL> def test_graph_flow_provides_required_values ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) , <EOL> utils . TaskOneArg ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_graph_flow_provides_provided_value_other_call ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = '<STR_LIT:x>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_graph_flow_multi_provides_and_requires_values ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) . add ( <EOL> utils . TaskMultiArgMultiReturn ( '<STR_LIT>' , <EOL> rebind = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:d>' , '<STR_LIT:e>' , '<STR_LIT:f>' ] ) , <EOL> utils . TaskMultiArgMultiReturn ( '<STR_LIT>' , <EOL> provides = [ '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT:k>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' , '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:z>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:d>' , '<STR_LIT:e>' , '<STR_LIT:f>' , '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT:k>' ] ) , flow . provides ) <EOL> def test_graph_cyclic_dependency ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' ) <EOL> self . assertRaisesRegexp ( exceptions . DependencyFailure , '<STR_LIT>' , <EOL> flow . add , <EOL> utils . TaskOneArgOneReturn ( provides = '<STR_LIT:a>' , <EOL> requires = [ '<STR_LIT:b>' ] ) , <EOL> utils . TaskOneArgOneReturn ( provides = '<STR_LIT:b>' , <EOL> requires = [ '<STR_LIT:c>' ] ) , <EOL> utils . TaskOneArgOneReturn ( provides = '<STR_LIT:c>' , <EOL> requires = [ '<STR_LIT:a>' ] ) ) <EOL> def test_task_requires_and_provides_same_values ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , utils . TaskOneArgOneReturn ( '<STR_LIT>' , requires = '<STR_LIT:x>' , <EOL> provides = '<STR_LIT:x>' ) ) <EOL> self . assertEqual ( set ( '<STR_LIT:x>' ) , flow . requires ) <EOL> self . assertEqual ( set ( '<STR_LIT:x>' ) , flow . provides ) <EOL> def test_retry_in_linear_flow_no_requirements_no_provides ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_retry_in_linear_flow_with_requirements ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_retry_in_linear_flow_with_provides ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . provides ) <EOL> def test_retry_in_linear_flow_requires_and_provides ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) , flow . provides ) <EOL> def test_retry_requires_and_provides_same_value ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . provides ) <EOL> def test_retry_in_unordered_flow_no_requirements_no_provides ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_retry_in_unordered_flow_with_requirements ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_retry_in_unordered_flow_with_provides ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . provides ) <EOL> def test_retry_in_unordered_flow_requires_and_provides ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) , flow . provides ) <EOL> def test_retry_in_graph_flow_no_requirements_no_provides ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_retry_in_graph_flow_with_requirements ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( ) , flow . provides ) <EOL> def test_retry_in_graph_flow_with_provides ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) ) <EOL> self . assertEqual ( set ( ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . provides ) <EOL> def test_retry_in_graph_flow_requires_and_provides ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) , flow . provides ) <EOL> def test_linear_flow_retry_and_task ( self ) : <EOL> flow = lf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> flow . add ( utils . TaskMultiArgOneReturn ( rebind = [ '<STR_LIT:a>' , '<STR_LIT:x>' , '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:z>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:c>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:z>' ] ) , flow . provides ) <EOL> def test_unordered_flow_retry_and_task ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> flow . add ( utils . TaskMultiArgOneReturn ( rebind = [ '<STR_LIT:a>' , '<STR_LIT:x>' , '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:z>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:c>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:z>' ] ) , flow . provides ) <EOL> def test_unordered_flow_retry_and_task_same_requires_provides ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , requires = [ '<STR_LIT:x>' ] ) ) <EOL> flow . add ( utils . TaskOneReturn ( provides = [ '<STR_LIT:x>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_unordered_flow_retry_and_task_provide_same_value ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' ] ) ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_unordered_flow_retry_two_tasks_provide_same_value ( self ) : <EOL> flow = uf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , provides = [ '<STR_LIT:y>' ] ) ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' ] ) , <EOL> utils . TaskOneReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) , flow . provides ) <EOL> def test_graph_flow_retry_and_task ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , <EOL> requires = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] , <EOL> provides = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> flow . add ( utils . TaskMultiArgOneReturn ( rebind = [ '<STR_LIT:a>' , '<STR_LIT:x>' , '<STR_LIT:c>' ] , <EOL> provides = [ '<STR_LIT:z>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' , '<STR_LIT:y>' , '<STR_LIT:c>' ] ) , flow . requires ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:z>' ] ) , flow . provides ) <EOL> def test_graph_flow_retry_and_task_dependency_provide_require ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , requires = [ '<STR_LIT:x>' ] ) ) <EOL> flow . add ( utils . TaskOneReturn ( provides = [ '<STR_LIT:x>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . requires ) <EOL> def test_graph_flow_retry_and_task_provide_same_value ( self ) : <EOL> flow = gf . Flow ( '<STR_LIT>' , retry . AlwaysRevert ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' ] ) ) <EOL> flow . add ( utils . TaskOneReturn ( '<STR_LIT>' , provides = [ '<STR_LIT:x>' ] ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:x>' ] ) , flow . provides ) <EOL> def test_builtin_retry_args ( self ) : <EOL> class FullArgsRetry ( retry . AlwaysRevert ) : <EOL> def execute ( self , history , ** kwargs ) : <EOL> pass <EOL> def revert ( self , history , ** kwargs ) : <EOL> pass <EOL> flow = lf . Flow ( '<STR_LIT>' , retry = FullArgsRetry ( requires = '<STR_LIT:a>' ) ) <EOL> self . assertEqual ( set ( [ '<STR_LIT:a>' ] ) , flow . requires ) </s>
