Add tests for argument formatting
This commit is contained in:
parent
08a572086b
commit
9a84c9edb6
|
@ -21,6 +21,7 @@ class TestMetafunc:
|
|||
metafunc = self.Metafunc(function)
|
||||
assert not metafunc.fixturenames
|
||||
repr(metafunc._calls)
|
||||
assert funcargs._format_args(function) == '()'
|
||||
|
||||
def test_function_basic(self):
|
||||
def func(arg1, arg2="qwe"): pass
|
||||
|
@ -29,6 +30,7 @@ class TestMetafunc:
|
|||
assert 'arg1' in metafunc.fixturenames
|
||||
assert metafunc.function is func
|
||||
assert metafunc.cls is None
|
||||
assert funcargs._format_args(func) == "(arg1, arg2='qwe')"
|
||||
|
||||
def test_addcall_no_args(self):
|
||||
def func(arg1): pass
|
||||
|
@ -38,6 +40,7 @@ class TestMetafunc:
|
|||
call = metafunc._calls[0]
|
||||
assert call.id == "0"
|
||||
assert not hasattr(call, 'param')
|
||||
assert funcargs._format_args(func) == "(arg1)"
|
||||
|
||||
def test_addcall_id(self):
|
||||
def func(arg1): pass
|
||||
|
@ -85,6 +88,7 @@ class TestMetafunc:
|
|||
metafunc.parametrize("y", [1,2])
|
||||
pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5,6]))
|
||||
pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5,6]))
|
||||
assert funcargs._format_args(func) == '(x, y)'
|
||||
|
||||
def test_parametrize_and_id(self):
|
||||
def func(x, y): pass
|
||||
|
|
Loading…
Reference in New Issue