Skip to content

Commit e4702d6

Browse files
committed
fix
1 parent 9e73f11 commit e4702d6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test_typing_extensions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,12 +1207,15 @@ class My(enum.Enum):
12071207

12081208
self.assertEqual(Literal[My.A].__args__, (My.A,))
12091209

1210-
def test_nested_literals_are_allowed(self):
1210+
def test_strange_parameters_are_allowed(self):
12111211
# These are explicitly allowed by the typing spec
1212-
Literal[int]
12131212
Literal[Literal[1, 2], Literal[4, 5]]
1214-
Literal[3j + 2, ..., ()]
12151213
Literal[b"foo", "bar"]
1214+
1215+
# Type checkers should reject these types, but we do not
1216+
# raise errors at runtime to maintain maximum flexibility
1217+
Literal[int]
1218+
Literal[3j + 2, ..., ()]
12161219
Literal[{"foo": 3, "bar": 4}]
12171220
Literal[T]
12181221

0 commit comments

Comments
 (0)