Example #1
0
def test_Composer_sub_missing(composer):
    arguments = dict(x=11, xy=(13, 14), xx=23, yy=24, a=100, b=200, c=300, sub_a=111, sub_c=333)
    argument_store = ArgumentStore(arguments)
    actual_arguments, objects = composer.partial(argument_store)
    _check_objects(objects)
    sub_composer = Composer(fab, fbc)
    with pytest.raises(TypeError) as exc_info:
        sub_actual_arguments, sub_objects = sub_composer.partial(argument_store, prefix='sub_')
    assert str(exc_info.value) == "fab: missing required argument b"
Example #2
0
def test_Composer_sub(composer):
    arguments = dict(x=11, xy=(13, 14), xx=23, yy=24, a=100, b=200, c=300, sub_a=111, sub_b=222, sub_c=333)
    argument_store = ArgumentStore(arguments)
    actual_arguments, objects = composer.partial(argument_store)
    _check_objects(objects)
    sub_composer = Composer(fab, fbc)
    sub_actual_arguments, sub_objects = sub_composer.partial(argument_store, prefix='sub_')
    assert sub_objects[0] == [111, 222]
    assert sub_objects[1] == [222, 333]
    composer.verify_argument_store(argument_store)
Example #3
0
def test_Composer_sub_unexpected(composer):
    arguments = dict(x=11, xy=(13, 14), xx=23, yy=24, zz=45, a=100, b=200, c=300, sub_a=111, sub_b=222, sub_c=333, sub_d=444)
    argument_store = ArgumentStore(arguments)
    actual_arguments, objects = composer.partial(argument_store)
    _check_objects(objects)
    sub_composer = Composer(fab, fbc)
    sub_actual_arguments, sub_objects = sub_composer.partial(argument_store, prefix='sub_')
    assert sub_objects[0] == [111, 222]
    assert sub_objects[1] == [222, 333]
    with pytest.raises(TypeError) as exc_info:
        composer.verify_argument_store(argument_store)
    assert str(exc_info.value) == "unexpected arguments: sub_d=444, zz=45"
Example #4
0
def test_Composer_sub_missing(composer):
    arguments = dict(x=11,
                     xy=(13, 14),
                     xx=23,
                     yy=24,
                     a=100,
                     b=200,
                     c=300,
                     sub_a=111,
                     sub_c=333)
    argument_store = ArgumentStore(arguments)
    actual_arguments, objects = composer.partial(argument_store)
    _check_objects(objects)
    sub_composer = Composer(fab, fbc)
    with pytest.raises(TypeError) as exc_info:
        sub_actual_arguments, sub_objects = sub_composer.partial(
            argument_store, prefix='sub_')
    assert str(exc_info.value) == "fab: missing required argument b"
Example #5
0
def test_Composer_sub(composer):
    arguments = dict(x=11,
                     xy=(13, 14),
                     xx=23,
                     yy=24,
                     a=100,
                     b=200,
                     c=300,
                     sub_a=111,
                     sub_b=222,
                     sub_c=333)
    argument_store = ArgumentStore(arguments)
    actual_arguments, objects = composer.partial(argument_store)
    _check_objects(objects)
    sub_composer = Composer(fab, fbc)
    sub_actual_arguments, sub_objects = sub_composer.partial(argument_store,
                                                             prefix='sub_')
    assert sub_objects[0] == [111, 222]
    assert sub_objects[1] == [222, 333]
    composer.verify_argument_store(argument_store)
Example #6
0
def test_Composer_sub_unexpected(composer):
    arguments = dict(x=11,
                     xy=(13, 14),
                     xx=23,
                     yy=24,
                     zz=45,
                     a=100,
                     b=200,
                     c=300,
                     sub_a=111,
                     sub_b=222,
                     sub_c=333,
                     sub_d=444)
    argument_store = ArgumentStore(arguments)
    actual_arguments, objects = composer.partial(argument_store)
    _check_objects(objects)
    sub_composer = Composer(fab, fbc)
    sub_actual_arguments, sub_objects = sub_composer.partial(argument_store,
                                                             prefix='sub_')
    assert sub_objects[0] == [111, 222]
    assert sub_objects[1] == [222, 333]
    with pytest.raises(TypeError) as exc_info:
        composer.verify_argument_store(argument_store)
    assert str(exc_info.value) == "unexpected arguments: sub_d=444, zz=45"
Example #7
0
def subcomposer():
    return Composer(fsub)
Example #8
0
def composer():
    return Composer(Alpha, Beta, Beta.build, gamma)