Skip to content

Commit 2c72948

Browse files
move testTernaryOperatorWithTypeVarDefault to python313.test
1 parent d5b7f50 commit 2c72948

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
@@ -2463,21 +2463,3 @@ x + T # E: Unsupported left operand type for + ("int")
24632463
T() # E: "TypeVar" not callable
24642464
[builtins fixtures/tuple.pyi]
24652465
[typing fixtures/typing-full.pyi]
2466-
2467-
[case testTernaryOperatorWithDefault]
2468-
# flags: --python-version 3.13
2469-
# gh-18817
2470-
2471-
class Ok[T, E = None]:
2472-
def __init__(self, value: T) -> None:
2473-
self._value = value
2474-
2475-
class Err[E, T = None]:
2476-
def __init__(self, value: E) -> None:
2477-
self._value = value
2478-
2479-
type Result[T, E] = Ok[T, E] | Err[E, T]
2480-
2481-
class Bar[U]:
2482-
def foo(data: U, cond: bool) -> Result[U, str]:
2483-
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
@@ -290,3 +290,21 @@ reveal_type(A1().x) # N: Revealed type is "builtins.int"
290290
reveal_type(A2().x) # N: Revealed type is "builtins.int"
291291
reveal_type(A3().x) # N: Revealed type is "builtins.int"
292292
[builtins fixtures/tuple.pyi]
293+
294+
295+
[case testTernaryOperatorWithTypeVarDefault]
296+
# gh-18817
297+
298+
class Ok[T, E = None]:
299+
def __init__(self, value: T) -> None:
300+
self._value = value
301+
302+
class Err[E, T = None]:
303+
def __init__(self, value: E) -> None:
304+
self._value = value
305+
306+
type Result[T, E] = Ok[T, E] | Err[E, T]
307+
308+
class Bar[U]:
309+
def foo(data: U, cond: bool) -> Result[U, str]:
310+
return Ok(data) if cond else Err("Error")

0 commit comments

Comments
 (0)