Skip to content

Commit 5a09eb0

Browse files
Update tests
1 parent bb885d3 commit 5a09eb0

File tree

8 files changed

+73
-31
lines changed

8 files changed

+73
-31
lines changed

data/fixtures/scopes/python/functionName.iteration.scope

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
class Foo:
22
def bar():
33
pass
4+
45
---
56

6-
[Range] =
7-
[Domain] = 0:0-2:12
7+
[#1 Range] = 1:4-2:12
8+
>----------
9+
1| def bar():
10+
2| pass
11+
------------<
12+
13+
[#1 Domain] = 0:0-2:12
814
>----------
915
0| class Foo:
1016
1| def bar():
1117
2| pass
1218
------------<
19+
20+
21+
[#2 Range] =
22+
[#2 Domain] = 0:0-3:0
23+
>----------
24+
0| class Foo:
25+
1| def bar():
26+
2| pass
27+
3|
28+
<
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
if value > 0:
22
pass
3+
elif value == 0:
4+
pass
5+
else:
6+
pass
37
---
48

59
[Content] =
610
[Removal] =
7-
[Domain] = 0:0-1:8
11+
[Domain] = 0:0-5:8
812
>-------------
913
0| if value > 0:
1014
1| pass
15+
2| elif value == 0:
16+
3| pass
17+
4| else:
18+
5| pass
1119
--------<
1220

1321
[Insertion delimiter] = "\n"

data/fixtures/scopes/python/namedFunction.iteration.scope

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
class Foo:
2-
def bar(aaa: str, bbb: int):
2+
def bar(aaa: str, bbb: int = 123):
33
pass
44
---
55

6+
[Content] = 1:33-1:36
7+
>---<
8+
1| def bar(aaa: str, bbb: int = 123):
9+
10+
[Removal] = 1:30-1:36
11+
>------<
12+
1| def bar(aaa: str, bbb: int = 123):
13+
14+
[Leading delimiter] = 1:30-1:33
15+
>---<
16+
1| def bar(aaa: str, bbb: int = 123):
17+
18+
[Domain] = 1:22-1:36
19+
>--------------<
20+
1| def bar(aaa: str, bbb: int = 123):
21+
22+
[Insertion delimiter] = " "
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
def bar(aaa: str, bbb: int):
1+
def bar(aaa: str, bbb: int = 123):
22
pass
33
---
44

5+
[Content] = 0:29-0:32
6+
>---<
7+
0| def bar(aaa: str, bbb: int = 123):
8+
9+
[Removal] = 0:26-0:32
10+
>------<
11+
0| def bar(aaa: str, bbb: int = 123):
12+
13+
[Leading delimiter] = 0:26-0:29
14+
>---<
15+
0| def bar(aaa: str, bbb: int = 123):
16+
17+
[Domain] = 0:18-0:32
18+
>--------------<
19+
0| def bar(aaa: str, bbb: int = 123):
20+
21+
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/python.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
22
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
33

4-
const { supported, notApplicable } = ScopeSupportFacetLevel;
4+
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
55

66
export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
77
"name.foreach": supported,
@@ -51,12 +51,10 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
5151
anonymousFunction: supported,
5252
namedFunction: supported,
5353
"namedFunction.constructor": supported,
54-
"namedFunction.iteration": supported,
5554
"namedFunction.iteration.document": supported,
5655
"namedFunction.method": supported,
5756

5857
functionName: supported,
59-
"functionName.iteration": supported,
6058
"functionName.constructor": supported,
6159
"functionName.iteration.document": supported,
6260
"functionName.method": supported,
@@ -139,6 +137,11 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
139137
pairDelimiter: supported,
140138
fieldAccess: supported,
141139

140+
// Unsupported
141+
142+
"namedFunction.iteration": unsupported,
143+
"functionName.iteration": unsupported,
144+
142145
// Not applicable
143146

144147
"class.iteration.block": notApplicable,

queries/python.scm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,10 @@
323323
)
324324

325325
(module) @namedFunction.iteration @functionName.iteration
326-
(class_definition) @namedFunction.iteration @functionName.iteration
326+
327+
(class_definition
328+
body: (_) @namedFunction.iteration @functionName.iteration
329+
) @namedFunction.iteration.domain @functionName.iteration.domain
327330

328331
;;!! def foo():
329332
;;!! a = 0

0 commit comments

Comments
 (0)