diff --git a/test-data/unit/check-expressions.test b/test-data/unit/check-expressions.test index 2a20b3f77add..58ae97d68224 100644 --- a/test-data/unit/check-expressions.test +++ b/test-data/unit/check-expressions.test @@ -2453,9 +2453,22 @@ T() # E: "TypeVar" not callable [builtins fixtures/tuple.pyi] [typing fixtures/typing-full.pyi] -[case testListComprehensionWithUnionTypeGenerator] +[case testListComprehensionWithTupleUnionTypeGenerator] class A: pass class B: pass a = A() b = B() -l3: list[A | B] = [x for x in [a, b]] \ No newline at end of file +l3: list[A | B] = [x for x in (a, b)] +l3: list[A | B] = [x for x in [a, b]] + +[case testListComprehensionWithListUnionTypeGenerator] +a = A() +b = "foo" +l3: list[A | str] = [x for x in (a, b)] +l3: list[A | str] = [x for x in [a, b]] + +[case testListComprehensionWithImmutableTypeUnionTypeGenerator] +a = 3.0 +b = 3 +l3: list[float | int] = [x for x in (a, b)] +l3: list[float | int] = [x for x in [a, b]]