File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -164,3 +164,24 @@ def test_edit_file_contents_file_error(service):
164
164
edit_result = result [file_path ]
165
165
assert edit_result .result == "error"
166
166
assert "no such file" in edit_result .reason .lower ()
167
+
168
+
169
+ def test_edit_file_unexpected_error (service , tmp_path ):
170
+ """Test handling of unexpected errors during file editing."""
171
+ # Setup test file and operation
172
+ test_file = str (tmp_path / "error_test.txt" )
173
+ operation = EditFileOperation (
174
+ path = test_file ,
175
+ hash = "dummy_hash" ,
176
+ patches = [EditPatch (contents = "test content\n " , line_start = 1 )],
177
+ )
178
+
179
+ # Try to edit non-existent file
180
+ result = service .edit_file_contents (test_file , operation )
181
+ edit_result = result [test_file ]
182
+
183
+ # Verify error handling
184
+ assert edit_result .result == "error"
185
+ assert "no such file" in edit_result .reason .lower ()
186
+ assert edit_result .hash is None
187
+ assert edit_result .content is None
You can’t perform that action at this time.
0 commit comments