Skip to content

Commit 9109962

Browse files
committed
test: wider expected return value
1 parent 11a6c13 commit 9109962

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test-data/unit/check-classes.test

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,44 @@ main:18: note: Expression tuple item 7 has type "Union[str, float]"; "str" expec
17041704
main:18: note: Expression tuple item 8 has type "Optional[str]"; "str" expected;
17051705
[builtins fixtures/property.pyi]
17061706

1707+
[case testPropertyWithTupleUnionAndNonUnionMismatchReturnValueType_wider_expeced_return]
1708+
from typing import Tuple, Union
1709+
class A:
1710+
a: str
1711+
b: str
1712+
c: str
1713+
d: str
1714+
e: str
1715+
f: str
1716+
g: str
1717+
h: str
1718+
i: str
1719+
j: str
1720+
k: str
1721+
l: Union[float, int]
1722+
1723+
@property
1724+
def x(self) -> Tuple[Union[str, int], Union[str, float], int, Union[str, None], Union[str, None], Union[str, None], str, str, str, str, str, str]:
1725+
return (
1726+
self.a,
1727+
self.b,
1728+
self.c,
1729+
self.d,
1730+
self.e,
1731+
self.f,
1732+
self.g,
1733+
self.h,
1734+
self.i,
1735+
self.j,
1736+
self.k,
1737+
self.l,
1738+
)
1739+
[out]
1740+
main:18: error: Incompatible return value type (2 tuple items are incompatible)
1741+
main:18: note: Expression tuple item 2 has type "str"; "int" expected;
1742+
main:18: note: Expression tuple item 11 has type "Union[float, int]"; "str" expected;
1743+
[builtins fixtures/property.pyi]
1744+
17071745
-- Descriptors
17081746
-- -----------
17091747

0 commit comments

Comments
 (0)