Пример #1
0
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')
    ]
Пример #2
0
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')])
Пример #3
0
 def hello_world(_info):
     return MultipleResults.from_dict({
         'left': {
             'foo': 'left'
         },
         'right': {
             'foo': 'right'
         }
     })
Пример #4
0
 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)})
Пример #5
0
def test_multiple_single_result():
    mr = MultipleResults(Result('value', 'output_one'))
    assert mr.results == [Result('value', 'output_one')]
Пример #6
0
 def hello_world(_info):
     return MultipleResults(
         Result(value={'foo': 'left'}, output_name='left'),
         Result(value={'foo': 'right'}, output_name='right'),
     )
Пример #7
0
def return_dict_results(_info):
    return MultipleResults.from_dict({'out_one': 23, 'out_two': 45})