@@ -108,29 +108,6 @@ def test_find_original_update_blocks(self):
108
108
edits = list (eb .find_original_update_blocks (edit ))
109
109
self .assertEqual (edits , [("foo.txt" , "Two\n " , "Tooooo\n " )])
110
110
111
- def test_find_original_update_blocks_mangled_filename_w_source_tag (self ):
112
- source = "source"
113
-
114
- edit = """
115
- Here's the change:
116
-
117
- <%s>foo.txt
118
- <<<<<<< SEARCH
119
- One
120
- =======
121
- Two
122
- >>>>>>> REPLACE
123
- </%s>
124
-
125
- Hope you like it!
126
- """ % (source , source )
127
-
128
- fence = ("<%s>" % source , "</%s>" % source )
129
-
130
- with self .assertRaises (ValueError ) as cm :
131
- _edits = list (eb .find_original_update_blocks (edit , fence ))
132
- self .assertIn ("missing filename" , str (cm .exception ))
133
-
134
111
def test_find_original_update_blocks_quote_below_filename (self ):
135
112
edit = """
136
113
Here's the change:
@@ -181,10 +158,11 @@ def test_find_original_update_blocks_missing_filename(self):
181
158
182
159
183
160
oops!
161
+ >>>>>>> REPLACE
184
162
"""
185
163
186
164
with self .assertRaises (ValueError ) as cm :
187
- list (eb .find_original_update_blocks (edit ))
165
+ _blocks = list (eb .find_original_update_blocks (edit ))
188
166
self .assertIn ("filename" , str (cm .exception ))
189
167
190
168
def test_find_original_update_blocks_no_final_newline (self ):
@@ -575,7 +553,7 @@ def test_find_original_update_blocks_quad_backticks_with_triples_in_LLM_reply(se
575
553
edits = list (eb .find_original_update_blocks (edit , fence = quad_backticks ))
576
554
self .assertEqual (edits , [("foo.txt" , "" , "Tooooo\n " )])
577
555
578
- #Test for shell script blocks with sh language identifier (issue #3785)
556
+ # Test for shell script blocks with sh language identifier (issue #3785)
579
557
def test_find_original_update_blocks_with_sh_language_identifier (self ):
580
558
# https://github.com/Aider-AI/aider/issues/3785
581
559
edit = """
@@ -609,13 +587,13 @@ def test_find_original_update_blocks_with_sh_language_identifier(self):
609
587
# Check that the content contains the expected shell script elements
610
588
result_content = edits [0 ][2 ]
611
589
self .assertIn ("#!/bin/bash" , result_content )
612
- self .assertIn (" if [ \ " $#\ " -ne 1 ];" , result_content )
613
- self .assertIn (" echo \ " Usage: $0 <argument>\" " , result_content )
590
+ self .assertIn (' if [ "$#" -ne 1 ];' , result_content )
591
+ self .assertIn (' echo "Usage: $0 <argument>"' , result_content )
614
592
self .assertIn ("exit 1" , result_content )
615
- self .assertIn (" echo \ " $1\" " , result_content )
593
+ self .assertIn (' echo "$1"' , result_content )
616
594
self .assertIn ("exit 0" , result_content )
617
595
618
- #Test for C# code blocks with csharp language identifier
596
+ # Test for C# code blocks with csharp language identifier
619
597
def test_find_original_update_blocks_with_csharp_language_identifier (self ):
620
598
edit = """
621
599
Here's a C# code change:
@@ -631,12 +609,9 @@ def test_find_original_update_blocks_with_csharp_language_identifier(self):
631
609
"""
632
610
633
611
edits = list (eb .find_original_update_blocks (edit ))
634
- search_text = "Console.WriteLine(\" Hello World!\" );\n "
635
- replace_text = "Console.WriteLine(\" Hello, C# World!\" );\n "
636
- self .assertEqual (
637
- edits ,
638
- [("Program.cs" , search_text , replace_text )]
639
- )
612
+ search_text = 'Console.WriteLine("Hello World!");\n '
613
+ replace_text = 'Console.WriteLine("Hello, C# World!");\n '
614
+ self .assertEqual (edits , [("Program.cs" , search_text , replace_text )])
640
615
641
616
642
617
if __name__ == "__main__" :
0 commit comments