Skip to content

Commit 7fee62b

Browse files
11happyntBre
andauthored
[semantic error tests]: refactor semantic error tests to separate files (#20926)
<!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> This PR refactors semantic error tests in each seperate file ## Test Plan <!-- How was it tested? --> ## CC - @ntBre --------- Signed-off-by: 11happy <[email protected]> Co-authored-by: Brent Westbrook <[email protected]>
1 parent 96b60c1 commit 7fee62b

File tree

45 files changed

+379
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+379
-467
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
async def f(): return [[x async for x in foo(n)] for n in range(3)]
2+
3+
async def test(): return [[x async for x in elements(n)] async for n in range(3)]
4+
5+
async def f(): [x for x in foo()] and [x async for x in foo()]
6+
7+
async def f():
8+
def g(): ...
9+
[x async for x in foo()]
10+
11+
[x async for x in y]
12+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
match x:
2+
case Point(x=1, x=2):
3+
pass
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
match x:
2+
case {'key': 1, 'key': 2}:
3+
pass
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class C[T, T]: pass
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
def f(a):
2+
global a
3+
4+
def g(a):
5+
if True:
6+
global a
7+
8+
def h(a):
9+
def inner():
10+
global a
11+
12+
def i(a):
13+
try:
14+
global a
15+
except Exception:
16+
pass
17+
18+
def f(a):
19+
a = 1
20+
global a
21+
22+
def f(a):
23+
a = 1
24+
a = 2
25+
global a
26+
27+
def f(a):
28+
class Inner:
29+
global a # ok
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
type X[T: (yield 1)] = int
2+
3+
type Y = (yield 1)
4+
5+
def f[T](x: int) -> (y := 3): return x
6+
7+
class C[T]((yield from [object])):
8+
pass
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def func():
2+
return *x
3+
4+
for *x in range(10):
5+
pass
6+
7+
def func():
8+
yield *x
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
match value:
2+
case _:
3+
pass
4+
case 1:
5+
pass
6+
7+
match value:
8+
case irrefutable:
9+
pass
10+
case 1:
11+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
match x:
2+
case [a, a]:
3+
pass
4+
case _:
5+
pass
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[x:= 2 for x in range(2)]

0 commit comments

Comments
 (0)