Replaced hasattr in dumps with supports_argument

This commit is contained in:
2024-05-26 21:39:55 +02:00
parent 15f9274050
commit 64ba9efa34
4 changed files with 50 additions and 2 deletions

24
tests/test_utils.py Normal file
View File

@@ -0,0 +1,24 @@
from typing import Callable
import pytest
from libbot._utils import supports_argument
def func1(foo: str, bar: str):
pass
def func2(foo: str):
pass
@pytest.mark.parametrize(
"func, arg_name, result",
[
(func1, "foo", True),
(func2, "bar", False),
],
)
def test_supports_argument(func: Callable, arg_name: str, result: bool):
assert supports_argument(func, arg_name) == result