Skip to content

Commit 27a6207

Browse files
committed
SQ: Fix test on Python 3.14+
1 parent a1c1293 commit 27a6207

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

tests.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,15 +2067,24 @@ class Point2D(mypy_extensions.TypedDict): # type: ignore[reportGeneralTypeIssue
20672067
class Point3D(Point2D, total=False): # type: ignore[reportGeneralTypeIssues] # pyright
20682068
z: int
20692069

2070-
self.assertRaisesRegex(
2071-
TypeNotSupportedError,
2072-
(
2073-
"trycast cannot determine which keys are required.*?"
2074-
"Suggest use a typing(_extensions)?.TypedDict.*?"
2075-
"strict=False"
2076-
),
2077-
lambda: trycast(Point3D, {"x": 1, "y": 2}, strict=True),
2078-
)
2070+
if sys.version_info[:2] >= (3, 14):
2071+
self.assertRaisesRegex(
2072+
TypeNotSupportedError,
2073+
(
2074+
"trycast cannot determine which keys exist"
2075+
),
2076+
lambda: trycast(Point3D, {"x": 1, "y": 2}, strict=True),
2077+
)
2078+
else:
2079+
self.assertRaisesRegex(
2080+
TypeNotSupportedError,
2081+
(
2082+
"trycast cannot determine which keys are required.*?"
2083+
"Suggest use a typing(_extensions)?.TypedDict.*?"
2084+
"strict=False"
2085+
),
2086+
lambda: trycast(Point3D, {"x": 1, "y": 2}, strict=True),
2087+
)
20792088

20802089
# NOTE: Cannot combine the following two if-checks with an `and`
20812090
# because that is too complicated for Pyre to understand.

0 commit comments

Comments
 (0)