Update test_types.py

This commit is contained in:
Jeremiah Lowin 2025-05-04 14:32:52 -04:00
commit 49d7bc92ff

View file

@ -245,3 +245,14 @@ class TestFindKwargByType:
pass
assert find_kwarg_by_type(func, BaseClass) == "b"
def test_nonstandard_annotation(self):
"""Test finding parameter with a nonstandard annotation like an
instance. This is irregular."""
SENTINEL = object()
def func(a: int, b: SENTINEL, c: str): # type: ignore
pass
assert find_kwarg_by_type(func, SENTINEL) is None # type: ignore