Skip to content

Commit 92bc6a4

Browse files
move testTernaryOperatorWithTypeVarDefault to python313.test
# Conflicts: # test-data/unit/check-python313.test
1 parent 38f36c3 commit 92bc6a4

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

test-data/unit/check-expressions.test

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,21 +2492,3 @@ x + T # E: Unsupported left operand type for + ("int")
24922492
T() # E: "TypeVar" not callable
24932493
[builtins fixtures/tuple.pyi]
24942494
[typing fixtures/typing-full.pyi]
2495-
2496-
[case testTernaryOperatorWithDefault]
2497-
# flags: --python-version 3.13
2498-
# gh-18817
2499-
2500-
class Ok[T, E = None]:
2501-
def __init__(self, value: T) -> None:
2502-
self._value = value
2503-
2504-
class Err[E, T = None]:
2505-
def __init__(self, value: E) -> None:
2506-
self._value = value
2507-
2508-
type Result[T, E] = Ok[T, E] | Err[E, T]
2509-
2510-
class Bar[U]:
2511-
def foo(data: U, cond: bool) -> Result[U, str]:
2512-
return Ok(data) if cond else Err("Error")

test-data/unit/check-python313.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,21 @@ class A[Y = X, X = int]: ... # E: Name "X" is not defined
319319

320320
class B[Y = X]: ... # E: Name "X" is not defined
321321
[builtins fixtures/tuple.pyi]
322+
323+
324+
[case testTernaryOperatorWithTypeVarDefault]
325+
# https://github.com/python/mypy/issues/18817
326+
327+
class Ok[T, E = None]:
328+
def __init__(self, value: T) -> None:
329+
self._value = value
330+
331+
class Err[E, T = None]:
332+
def __init__(self, value: E) -> None:
333+
self._value = value
334+
335+
type Result[T, E] = Ok[T, E] | Err[E, T]
336+
337+
class Bar[U]:
338+
def foo(data: U, cond: bool) -> Result[U, str]:
339+
return Ok(data) if cond else Err("Error")

0 commit comments

Comments
 (0)