Fix not all args are passed to handler function invocation (#633)

This commit is contained in:
evgfilim1 2021-07-18 16:10:51 +05:00 committed by GitHub
parent 125fc22ff9
commit 4599913e18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -22,6 +22,10 @@ async def callback3(foo: int, **kwargs):
return locals()
async def callback4(foo: int, *, bar: int, baz: int):
return locals()
class Filter(BaseFilter):
async def __call__(self, foo: int, bar: int, baz: int) -> Union[bool, Dict[str, Any]]:
return locals()
@ -95,11 +99,21 @@ class TestCallableMixin:
{"foo": 42, "spam": True, "baz": "fuz", "bar": "test"},
{"foo": 42, "baz": "fuz", "bar": "test"},
),
pytest.param(
functools.partial(callback2, bar="test"),
{"foo": 42, "spam": True, "baz": "fuz"},
{"foo": 42, "baz": "fuz"},
),
pytest.param(
callback3,
{"foo": 42, "spam": True, "baz": "fuz", "bar": "test"},
{"foo": 42, "spam": True, "baz": "fuz", "bar": "test"},
),
pytest.param(
callback4,
{"foo": 42, "spam": True, "baz": "fuz", "bar": "test"},
{"foo": 42, "baz": "fuz", "bar": "test"},
),
pytest.param(
Filter(), {"foo": 42, "spam": True, "baz": "fuz"}, {"foo": 42, "baz": "fuz"}
),