diff --git a/type-enum/tests/test_instantiation.py b/type-enum/tests/test_instantiation.py index e6912f4..7b0fc26 100644 --- a/type-enum/tests/test_instantiation.py +++ b/type-enum/tests/test_instantiation.py @@ -77,6 +77,9 @@ def f(x: Maybe.T[int]) -> int: with self.assertRaises(TypeError): Maybe.Some[int, str](3) # type: ignore[misc] + with self.assertRaises(TypeError): + Maybe.T[int, str] # type: ignore[misc,type-arg] + def test_generic_multi(self) -> None: U = TypeVar("U") V = TypeVar("V") @@ -98,6 +101,13 @@ def f(x: E.T[str, int]) -> int: self.assertEqual(f(a), 3) self.assertEqual(repr(a), "E.A(3)") + def test_generic_without_base_class(self) -> None: + U = TypeVar("U") + + class Maybe(TypeEnum): + Some: Type[Tuple[U]] # type: ignore[valid-type] + Nothing: Type[Tuple[()]] + def test_invalid_body(self) -> None: with self.assertRaises(TypeError):