Skip to content

Commit 00fda72

Browse files
committed
Minor updates to tests
1 parent e0d2cfb commit 00fda72

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

crates/ty_python_semantic/resources/mdtest/scopes/eager.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ x = int
389389
class C:
390390
var: ClassVar[x]
391391

392-
# TODO: should be `Unknown | str`
392+
# TODO: should ideally be `Unknown | str`, but we currently consider all reachable bindings
393393
reveal_type(C.var) # revealed: Unknown | int | str
394394

395395
x = str
@@ -405,7 +405,7 @@ x = int
405405
class C:
406406
var: ClassVar[x]
407407

408-
# TODO: should be `str`
408+
# TODO: should ideally be `str`, but we currently consider all reachable bindings
409409
reveal_type(C.var) # revealed: int | str
410410

411411
x = str

crates/ty_python_semantic/resources/mdtest/statically_known_branches.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,32 +1242,48 @@ def f() -> None:
12421242

12431243
#### `if True`
12441244

1245+
`mod.py`:
1246+
12451247
```py
12461248
x: str
12471249

12481250
if True:
12491251
x: int
1252+
```
12501253

1251-
def f() -> None:
1252-
reveal_type(x) # revealed: str | int
1254+
`main.py`:
1255+
1256+
```py
1257+
from mod import x
1258+
1259+
reveal_type(x) # revealed: int
12531260
```
12541261

12551262
#### `if False … else`
12561263

1264+
`mod.py`:
1265+
12571266
```py
12581267
x: str
12591268

12601269
if False:
12611270
pass
12621271
else:
12631272
x: int
1273+
```
12641274

1265-
def f() -> None:
1266-
reveal_type(x) # revealed: str | int
1275+
`main.py`:
1276+
1277+
```py
1278+
from mod import x
1279+
1280+
reveal_type(x) # revealed: int
12671281
```
12681282

12691283
### Ambiguous
12701284

1285+
`mod.py`:
1286+
12711287
```py
12721288
def flag() -> bool:
12731289
return True
@@ -1276,9 +1292,14 @@ x: str
12761292

12771293
if flag():
12781294
x: int
1295+
```
12791296

1280-
def f() -> None:
1281-
reveal_type(x) # revealed: str | int
1297+
`main.py`:
1298+
1299+
```py
1300+
from mod import x
1301+
1302+
reveal_type(x) # revealed: str | int
12821303
```
12831304

12841305
## Conditional function definitions

crates/ty_python_semantic/resources/mdtest/terminal_statements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ def top_level_return(cond1: bool, cond2: bool):
583583
x = 1
584584

585585
def g():
586-
# TODO We could potentially eliminate Unknown here, if we make sure
587-
# that `g` is only called from within `top_level_return`.
586+
# TODO We could potentially eliminate `Unknown` from the union here,
587+
# if we make sure that `g` is only called from within `top_level_return`.
588588
reveal_type(x) # revealed: Unknown | Literal[1, 2, 3]
589589
if cond1:
590590
if cond2:

0 commit comments

Comments
 (0)