@@ -280,3 +280,33 @@ async def test_edit_file_contents_with_preserving_newlines(editor, tmp_path):
280
280
expected_content = "line1\n new line2\n line3\n "
281
281
final_content = test_file .read_text ()
282
282
assert final_content == expected_content
283
+
284
+
285
+ @pytest .mark .asyncio
286
+ async def test_read_multiple_ranges (editor , test_file ):
287
+ """Test reading multiple ranges including ranges with no end specified."""
288
+ ranges = [
289
+ {
290
+ "file_path" : test_file ,
291
+ "ranges" : [
292
+ {"start" : 1 }, # Read from start to end (no end specified)
293
+ {"start" : 2 , "end" : 4 }, # Read specific range
294
+ ],
295
+ }
296
+ ]
297
+
298
+ result = await editor .read_multiple_ranges (ranges )
299
+
300
+ # Check first range (entire file)
301
+ first_range = result [test_file ][0 ]
302
+ assert first_range ["content" ] == "Line 1\n Line 2\n Line 3\n Line 4\n Line 5\n "
303
+ assert first_range ["start_line" ] == 1
304
+ assert first_range ["end_line" ] == 5
305
+ assert first_range ["total_lines" ] == 5
306
+
307
+ # Check second range (specific lines)
308
+ second_range = result [test_file ][1 ]
309
+ assert second_range ["content" ] == "Line 2\n Line 3\n Line 4\n "
310
+ assert second_range ["start_line" ] == 2
311
+ assert second_range ["end_line" ] == 4
312
+ assert second_range ["total_lines" ] == 5
0 commit comments