def test_hint_with_none_default_raises(self): def _test_func(a, b, c: str = None, **kwargs): pass params = {"a": 1, "b": 2, "c": 3} with pytest.raises(TypeError): validate_signature([_test_func], params)
def test_mixed_hints_raises(self): def _test_func(a: str, b, c, **kwargs): pass params = {"a": 1, "b": 2, "c": 3} with pytest.raises(TypeError): validate_signature([_test_func], params)
def test_hint_with_none_default_but_set(self): def _test_func(a, b, c: str = None, **kwargs): pass params = {"a": 1, "b": 2, "c": "foobar"} validated_params = validate_signature([_test_func], params) assert validated_params == {"a": 1, "b": 2, "c": "foobar"}
def test_hints_defaults_override(self): def _test_func(a, b, c: str = "asdf", **kwargs): pass params = {"a": 1, "b": 2, "c": "foobar"} validated_params = validate_signature([_test_func], params) assert validated_params == {"a": 1, "b": 2, "c": "foobar"}
def test_mixed_hints(self): def _test_func(a: str, b, c, **kwargs): pass params = {"a": "foo", "b": 2, "c": 3} validated_params = validate_signature([_test_func], params) assert validated_params == {"a": "foo", "b": 2, "c": 3}
def test_no_hints(self): def _test_func(a, b, c, **kwargs): pass params = {"a": 1, "b": 2, "c": 3} validated_params = validate_signature([_test_func], params) assert validated_params == {"a": 1, "b": 2, "c": 3}