Example #1
0
def test_class_without_parameters():
    aldo = Aldo(Bar)
    parameters = aldo.parameters()
    assert(2 == len(parameters.args)) # self counts too
    response = aldo()
    assert(isinstance(response, Bar))
    assert(isinstance(response.foo, Foo))
Example #2
0
def test_with_known_positional_parameters():
    aldo = Aldo(with_positional_parameters, first = 10, second = 20)
    parameters = aldo.parameters()
    assert(2 == len(parameters.args))
    first, second = aldo()
    assert(10 == first)
    assert(20 == second)
Example #3
0
def test_function_with_recursive_parameters():
    aldo = Aldo(with_recursive_parameters)
    parameters = aldo.parameters()
    assert(1 == len(parameters.args))
    response = aldo()
    assert(isinstance(response, Bar))
    assert(isinstance(response.foo, Foo))
Example #4
0
def test_with_positional_parameters():
    aldo = Aldo(with_positional_parameters)
    parameters = aldo.parameters()
    assert(2 == len(parameters.args))
    with pytest.raises(TypeError):
        aldo()
Example #5
0
def test_class_without_parameters():
    aldo = Aldo(Foo)
    parameters = aldo.parameters()
    assert(0 == len(parameters.args))
    response = aldo()
    assert(isinstance(response, Foo))
Example #6
0
def test_function_with_named_parameters():
    aldo = Aldo(with_named_parameters)
    parameters = aldo.parameters()
    assert(1 == len(parameters.args))
    response = aldo()
    assert(isinstance(response, Foo))
Example #7
0
def test_function_without_parameters():
    aldo = Aldo(without_parameters)
    parameters = aldo.parameters()
    assert(0 == len(parameters.args))
    assert(True == aldo())