Skip to content

Commit 0d64b55

Browse files
committed
TODO Fix bug
1 parent f38c836 commit 0d64b55

File tree

6 files changed

+136
-4
lines changed

6 files changed

+136
-4
lines changed

src/cedarscript_editor/cedarscript_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def restrict_search_range(action, target, identifier_finder: IdentifierFinder) -
311311
return inner_boundaries.whole
312312
case RangeSpec() as inner_range_spec:
313313
return inner_range_spec
314-
case _ as invalid: # Marker (LINE) or Segment
314+
case _ as invalid: # Segment
315315
# TODO
316316
raise ValueError(f'Not implemented: {invalid}')
317317
return RangeSpec.EMPTY

tests/corpus/update.identifier.replace.line/chat.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ UPDATE FUNCTION "fun2"
44
FROM FILE "1.py"
55
REPLACE LINE "def fun2(self, a, b, c):"
66
WITH CONTENT '''
7-
µ@0:def fun2(a, b, c):
7+
@0:def fun2(a, b, c):
88
''';
99

1010
UPDATE FUNCTION "calculate"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
class A:
2+
def a(self):
3+
def calculate(
4+
a,
5+
b,
6+
c,
7+
d,
8+
e
9+
):
10+
return a + b
11+
def helper(
12+
a,
13+
b
14+
):
15+
pass
16+
class B:
17+
def helper0(
18+
a,
19+
b
20+
):
21+
pass
22+
def a(self):
23+
def calculate(
24+
a,
25+
b,
26+
c,
27+
d,
28+
e
29+
):
30+
return a + b
31+
def helper(
32+
a,
33+
b,
34+
e
35+
):
36+
pass
37+
def a(self):
38+
def calculate(
39+
a,
40+
b,
41+
c,
42+
d,
43+
e
44+
):
45+
return a + b
46+
class C:
47+
def a(self):
48+
def calculate(
49+
a,
50+
b,
51+
c,
52+
d,
53+
e
54+
):
55+
return a + b
56+
def helper(
57+
a,
58+
b
59+
):
60+
pass
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<no-train>
2+
```CEDARScript
3+
UPDATE CLASS "B"
4+
FROM FILE "1.py"
5+
REPLACE SEGMENT
6+
STARTING BEFORE LINE "a," OFFSET 1
7+
ENDING AFTER LINE "e" OFFSET 0
8+
WITH CONTENT '''
9+
@-2:def calculate_plus_5(
10+
@-1:a, b
11+
@-2):
12+
@-1:a += 5
13+
''';
14+
```
15+
</no-train>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
class A:
2+
def a(self):
3+
def calculate(
4+
a,
5+
b,
6+
c,
7+
d,
8+
e
9+
):
10+
return a + b
11+
def helper(
12+
a,
13+
b
14+
):
15+
pass
16+
class B:
17+
def helper0(
18+
a,
19+
b
20+
):
21+
pass
22+
def a(self):
23+
def calculate_plus_5(
24+
a, b,
25+
):
26+
a += 5
27+
return a + b
28+
def helper(
29+
a,
30+
b,
31+
e
32+
):
33+
pass
34+
def a(self):
35+
def calculate(
36+
a,
37+
b,
38+
c,
39+
d,
40+
e
41+
):
42+
return a + b
43+
class C:
44+
def a(self):
45+
def calculate(
46+
a,
47+
b,
48+
c,
49+
d,
50+
e
51+
):
52+
return a + b
53+
def helper(
54+
a,
55+
b
56+
):
57+
pass

tests/test_corpus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def check_expected_files(dir_path: Path):
7878
expected_file = test_dir / f"expected.{rel_path}"
7979
assert expected_file.exists(), f"Expected file not found: {expected_file}"
8080

81-
expected_content = expected_file.read_text()
82-
result_content = path.read_text()
81+
expected_content = f"[{rel_path}] \n" + expected_file.read_text()
82+
result_content = f"[{rel_path}] \n" + path.read_text()
8383
assert result_content.strip() == expected_content.strip(), \
8484
f"Output does not match expected content for {rel_path}"
8585

0 commit comments

Comments
 (0)