示例#1
0
def test_args_str_default():
    assert argsCaller(do_something_default,
                      "a").args_str() == "<name> [<family> = Black]"
示例#2
0
def test_too_many_arguments():
    with pytest.raises(TooManyArgument) as pytest_wrapped_e:
        argsCaller(do_something, "a", "b")
    assert pytest_wrapped_e.value.argument_value == "b"
示例#3
0
def test_args_str_single():
    assert argsCaller(do_something, "a").args_str() == "<name>"
示例#4
0
def test_single_default_argument():
    assert argsCaller(do_something_default, "Joe").call() == "Joe Black"
示例#5
0
def test_missing_argument():
    with pytest.raises(MissingArgument) as pytest_wrapped_e:
        argsCaller(do_something)
    assert pytest_wrapped_e.value.argument_name == "name"
示例#6
0
def test_many_kwarguments():
    assert argsCaller(do_something, a=12, b=15, c=5).call() == "a12:b15:c5"
示例#7
0
def test_single_argument():
    assert argsCaller(do_something, "a").call() == "A"
示例#8
0
def test_single_argument():
    with pytest.raises(TooManyArgument) as pytest_wrapped_e:
        assert argsCaller(do_something, "a")
    assert pytest_wrapped_e.value.argument_value == "a"
示例#9
0
def test_single_kwargument():
    assert argsCaller(do_something, a=12).call() == "a12"
示例#10
0
def test_many_kwarguments():
    assert argsCaller(sum_int, *args).call() == 3
    assert argsCaller(sum_str, *args).call() == "12"
示例#11
0
def test_missing_argument():
    a_caller = argsCaller(do_something)
    assert (a_caller.call()) == ""
示例#12
0
def test_unsupported_keyword():
    with pytest.raises(UnsupportedKeyArgument) as pytest_wrapped_e:
        argsCaller(do_something, name="Joe", color="red")
    assert pytest_wrapped_e.value.argument_name == "color"
示例#13
0
def test_keyword_arguments():
    with pytest.raises(UnsupportedKeyArgument) as pytest_wrapped_e:
        argsCaller(do_something, name="Joe")
    assert pytest_wrapped_e.value.argument_name == "name"
示例#14
0
def test_many_arguments():
    assert argsCaller(do_something, "a", "b", "c").call() == "a:b:c"
示例#15
0
def test_default_argument():
    assert argsCaller(do_something_default).call() == "JOE"
示例#16
0
def test_no_arguments():
    assert argsCaller(do_something).call() == "A"