def test_multiple_double_result(): mr = MultipleResults(Result('value_one', 'output_one'), Result('value_two', 'output_two')) assert mr.results == [ Result('value_one', 'output_one'), Result('value_two', 'output_two') ]
def test_multiple_dict(): mr = MultipleResults.from_dict({ 'output_one': 'value_one', 'output_two': 'value_two' }) assert set(mr.results) == set( [Result('value_one', 'output_one'), Result('value_two', 'output_two')])
def hello_world(_info): return MultipleResults.from_dict({ 'left': { 'foo': 'left' }, 'right': { 'foo': 'right' } })
def solid_fn(info, **_kwargs): for i in range(200): time.sleep(0.02) if i % 1000 == 420: info.log.error( 'Error message seq={i} from solid {name}'.format( i=i, name=name)) elif i % 100 == 0: info.log.warning( 'Warning message seq={i} from solid {name}'.format( i=i, name=name)) elif i % 10 == 0: info.log.info('Info message seq={i} from solid {name}'.format( i=i, name=name)) else: info.log.debug( 'Debug message seq={i} from solid {name}'.format( i=i, name=name)) return MultipleResults.from_dict( {'output_{}'.format(i): 'foo' for i in range(n_outputs)})
def test_multiple_single_result(): mr = MultipleResults(Result('value', 'output_one')) assert mr.results == [Result('value', 'output_one')]
def hello_world(_info): return MultipleResults( Result(value={'foo': 'left'}, output_name='left'), Result(value={'foo': 'right'}, output_name='right'), )
def return_dict_results(_info): return MultipleResults.from_dict({'out_one': 23, 'out_two': 45})