Skip to content

Commit e36a0c7

Browse files
committed
refactor: move test
1 parent 57177bf commit e36a0c7

File tree

2 files changed

+77
-77
lines changed

2 files changed

+77
-77
lines changed

test-data/unit/check-classes.test

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,83 +1665,6 @@ a.f = a.f # E: Property "f" defined in "A" is read-only
16651665
a.f.x # E: "int" has no attribute "x"
16661666
[builtins fixtures/property.pyi]
16671667

1668-
[case testPropertyReturnTypeMismatchUnion]
1669-
from typing import Tuple, Union
1670-
class A:
1671-
a: str
1672-
b: str
1673-
c: str
1674-
d: str
1675-
e: str
1676-
f: str
1677-
g: Union[str, int]
1678-
h: Union[str, float]
1679-
i: Union[str, None]
1680-
j: Union[str, None]
1681-
k: Union[str, None]
1682-
l: Union[str, None]
1683-
1684-
@property
1685-
def x(self) -> Tuple[str, str, str, str, str, str, str, str, str, str, str, str]:
1686-
return (
1687-
self.a,
1688-
self.b,
1689-
self.c,
1690-
self.d,
1691-
self.e,
1692-
self.f,
1693-
self.g,
1694-
self.h,
1695-
self.i,
1696-
self.j,
1697-
self.k,
1698-
self.l,
1699-
)
1700-
[out]
1701-
main:18: error: Incompatible return value type (6 tuple items are incompatible; 3 items are omitted)
1702-
main:18: note: Expression tuple item 6 has type "Union[str, int]"; "str" expected;
1703-
main:18: note: Expression tuple item 7 has type "Union[str, float]"; "str" expected;
1704-
main:18: note: Expression tuple item 8 has type "Optional[str]"; "str" expected;
1705-
[builtins fixtures/property.pyi]
1706-
1707-
[case testPropertyTupleReturnTypeMismatchUnionWiderExpected]
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-
17451668
-- Descriptors
17461669
-- -----------
17471670

test-data/unit/check-tuples.test

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,83 @@ t6: Tuple[int, int, int, int, int, int, int, int, int, int, int, int] = (1, 2, 3
16071607

16081608
[builtins fixtures/tuple.pyi]
16091609

1610+
[case testPropertyLongTupleReturnTypeMismatchUnion]
1611+
from typing import Tuple, Union
1612+
class A:
1613+
a: str
1614+
b: str
1615+
c: str
1616+
d: str
1617+
e: str
1618+
f: str
1619+
g: Union[str, int]
1620+
h: Union[str, float]
1621+
i: Union[str, None]
1622+
j: Union[str, None]
1623+
k: Union[str, None]
1624+
l: Union[str, None]
1625+
1626+
@property
1627+
def x(self) -> Tuple[str, str, str, str, str, str, str, str, str, str, str, str]:
1628+
return (
1629+
self.a,
1630+
self.b,
1631+
self.c,
1632+
self.d,
1633+
self.e,
1634+
self.f,
1635+
self.g,
1636+
self.h,
1637+
self.i,
1638+
self.j,
1639+
self.k,
1640+
self.l,
1641+
)
1642+
[out]
1643+
main:18: error: Incompatible return value type (6 tuple items are incompatible; 3 items are omitted)
1644+
main:18: note: Expression tuple item 6 has type "Union[str, int]"; "str" expected;
1645+
main:18: note: Expression tuple item 7 has type "Union[str, float]"; "str" expected;
1646+
main:18: note: Expression tuple item 8 has type "Optional[str]"; "str" expected;
1647+
[builtins fixtures/property.pyi]
1648+
1649+
[case testPropertyLongTupleReturnTypeMismatchUnionWiderExpected]
1650+
from typing import Tuple, Union
1651+
class A:
1652+
a: str
1653+
b: str
1654+
c: str
1655+
d: str
1656+
e: str
1657+
f: str
1658+
g: str
1659+
h: str
1660+
i: str
1661+
j: str
1662+
k: str
1663+
l: Union[float, int]
1664+
1665+
@property
1666+
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]:
1667+
return (
1668+
self.a,
1669+
self.b,
1670+
self.c,
1671+
self.d,
1672+
self.e,
1673+
self.f,
1674+
self.g,
1675+
self.h,
1676+
self.i,
1677+
self.j,
1678+
self.k,
1679+
self.l,
1680+
)
1681+
[out]
1682+
main:18: error: Incompatible return value type (2 tuple items are incompatible)
1683+
main:18: note: Expression tuple item 2 has type "str"; "int" expected;
1684+
main:18: note: Expression tuple item 11 has type "Union[float, int]"; "str" expected;
1685+
[builtins fixtures/property.pyi]
1686+
16101687
[case testTupleWithStarExpr]
16111688
from typing import Tuple, List
16121689
points = (1, "test") # type: Tuple[int, str]

0 commit comments

Comments
 (0)