mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
call_with_supported_arguments() util, refs #581
This commit is contained in:
parent
9e6075d21f
commit
41a0cd7b6a
2 changed files with 22 additions and 0 deletions
|
|
@ -446,3 +446,14 @@ async def test_request_post_vars():
|
|||
|
||||
request = Request(scope, receive)
|
||||
assert {"foo": "bar", "baz": "1"} == await request.post_vars()
|
||||
|
||||
|
||||
def test_call_with_supported_arguments():
|
||||
def foo(a, b):
|
||||
return "{}+{}".format(a, b)
|
||||
|
||||
assert "1+2" == utils.call_with_supported_arguments(foo, a=1, b=2)
|
||||
assert "1+2" == utils.call_with_supported_arguments(foo, a=1, b=2, c=3)
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
utils.call_with_supported_arguments(foo, a=1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue