Skip to content

Commit

Permalink
More tests (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmke8 authored Dec 14, 2023
1 parent a4b9750 commit a6f8ad2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions type-enum/tests/test_instantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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):

Expand Down

0 comments on commit a6f8ad2

Please sign in to comment.