Skip to content

Commit 72bdd32

Browse files
committed
Add additional tests for immutable/mutable type cases and tuple vs. list iterators.
1 parent 9e9279d commit 72bdd32

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test-data/unit/check-expressions.test

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,9 +2453,22 @@ T() # E: "TypeVar" not callable
24532453
[builtins fixtures/tuple.pyi]
24542454
[typing fixtures/typing-full.pyi]
24552455

2456-
[case testListComprehensionWithUnionTypeGenerator]
2456+
[case testListComprehensionWithTupleUnionTypeGenerator]
24572457
class A: pass
24582458
class B: pass
24592459
a = A()
24602460
b = B()
2461-
l3: list[A | B] = [x for x in [a, b]]
2461+
l3: list[A | B] = [x for x in (a, b)]
2462+
l3: list[A | B] = [x for x in [a, b]]
2463+
2464+
[case testListComprehensionWithListUnionTypeGenerator]
2465+
a = A()
2466+
b = "foo"
2467+
l3: list[A | str] = [x for x in (a, b)]
2468+
l3: list[A | str] = [x for x in [a, b]]
2469+
2470+
[case testListComprehensionWithImmutableTypeUnionTypeGenerator]
2471+
a = 3.0
2472+
b = 3
2473+
l3: list[float | int] = [x for x in (a, b)]
2474+
l3: list[float | int] = [x for x in [a, b]]

0 commit comments

Comments
 (0)