@@ -155,3 +155,72 @@ async def test_delete_with_out_of_range(editor, test_file):
155
155
assert result ["result" ] == "error"
156
156
assert "line number out of range" in result ["reason" ].lower ()
157
157
assert test_file .read_text () == "Line 1\n Line 2\n Line 3\n Line 4\n Line 5\n "
158
+
159
+
160
+ @pytest .mark .asyncio
161
+ async def test_delete_without_file_path (editor ):
162
+ """Test deleting without specifying file_path"""
163
+ with pytest .raises (
164
+ TypeError , match = "missing 1 required positional argument: 'file_path'"
165
+ ):
166
+ await editor .delete_text_file_contents (
167
+ file_hash = "any_hash" ,
168
+ range_hash = "any_hash" ,
169
+ start_line = 1 ,
170
+ end_line = 1 ,
171
+ )
172
+
173
+
174
+ @pytest .mark .asyncio
175
+ async def test_delete_without_file_hash (editor , test_file ):
176
+ """Test deleting without specifying file_hash"""
177
+ with pytest .raises (
178
+ TypeError , match = "missing 1 required positional argument: 'file_hash'"
179
+ ):
180
+ await editor .delete_text_file_contents (
181
+ file_path = str (test_file ),
182
+ range_hash = "any_hash" ,
183
+ start_line = 1 ,
184
+ end_line = 1 ,
185
+ )
186
+
187
+
188
+ @pytest .mark .asyncio
189
+ async def test_delete_without_range_hash (editor , test_file ):
190
+ """Test deleting without specifying range_hash"""
191
+ with pytest .raises (
192
+ TypeError , match = "missing 1 required positional argument: 'range_hash'"
193
+ ):
194
+ await editor .delete_text_file_contents (
195
+ file_path = str (test_file ),
196
+ file_hash = "any_hash" ,
197
+ start_line = 1 ,
198
+ end_line = 1 ,
199
+ )
200
+
201
+
202
+ @pytest .mark .asyncio
203
+ async def test_delete_relative_path (editor ):
204
+ """Test deleting with relative path"""
205
+ with pytest .raises (RuntimeError , match = "File path must be absolute" ):
206
+ await editor .delete_text_file_contents (
207
+ file_path = "relative/path/file.txt" ,
208
+ file_hash = "any_hash" ,
209
+ range_hash = "any_hash" ,
210
+ start_line = 1 ,
211
+ end_line = 1 ,
212
+ )
213
+
214
+
215
+ @pytest .mark .asyncio
216
+ async def test_delete_nonexistent_file (editor , tmp_path ):
217
+ """Test deleting a file that doesn't exist"""
218
+ nonexistent_file = tmp_path / "nonexistent.txt"
219
+ with pytest .raises (RuntimeError , match = "File does not exist" ):
220
+ await editor .delete_text_file_contents (
221
+ file_path = str (nonexistent_file ),
222
+ file_hash = "any_hash" ,
223
+ range_hash = "any_hash" ,
224
+ start_line = 1 ,
225
+ end_line = 1 ,
226
+ )
0 commit comments