Skip to content

Commit 94a048a

Browse files
committed
Revert bad Ruff autofixes
1 parent 398e006 commit 94a048a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/test_typing_extensions.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ def test_illegal_parameters_do_not_raise_runtime_errors(self):
12111211
# Type checkers should reject these types, but we do not
12121212
# raise errors at runtime to maintain maximum flexibility
12131213
Literal[int]
1214-
Literal[1, 2, 4, 5]
1214+
Literal[Literal[1, 2], Literal[4, 5]]
12151215
Literal[3j + 2, ..., ()]
12161216
Literal[b"foo", "bar"]
12171217
Literal[{"foo": 3, "bar": 4}]
@@ -1283,7 +1283,7 @@ def test_hash(self):
12831283
def test_args(self):
12841284
self.assertEqual(Literal[1, 2, 3].__args__, (1, 2, 3))
12851285
self.assertEqual(Literal[1, 2, 3, 3].__args__, (1, 2, 3))
1286-
self.assertEqual(Literal[1, 2, 3, 4].__args__, (1, 2, 3, 4))
1286+
self.assertEqual(Literal[1, Literal[2], Literal[3, 4]].__args__, (1, 2, 3, 4))
12871287
# Mutable arguments will not be deduplicated
12881288
self.assertEqual(Literal[[], []].__args__, ([], []))
12891289

@@ -1346,9 +1346,9 @@ class Ints(enum.IntEnum):
13461346
(Literal[1], Literal[Ints.B]))
13471347

13481348
def test_flatten(self):
1349-
l1 = Literal[1, 2, 3]
1350-
l2 = Literal[1, 2, 3]
1351-
l3 = Literal[1, 2, 3]
1349+
l1 = Literal[Literal[1], Literal[2], Literal[3]]
1350+
l2 = Literal[Literal[1, 2], 3]
1351+
l3 = Literal[Literal[1, 2, 3]]
13521352
for lit in l1, l2, l3:
13531353
self.assertEqual(lit, Literal[1, 2, 3])
13541354
self.assertEqual(lit.__args__, (1, 2, 3))
@@ -1359,7 +1359,12 @@ class Ints(enum.IntEnum):
13591359
A = 1
13601360
B = 2
13611361

1362-
literal = Literal[Ints.A, Ints.B, 1, 2]
1362+
literal = Literal[
1363+
Literal[Ints.A],
1364+
Literal[Ints.B],
1365+
Literal[1],
1366+
Literal[2],
1367+
]
13631368
self.assertEqual(literal.__args__, (Ints.A, Ints.B, 1, 2))
13641369

13651370
def test_caching_of_Literal_respects_type(self):

0 commit comments

Comments
 (0)