(self)
| 361 | self.assertEqual(content, "creating a new file\n") |
| 362 | |
| 363 | def test_full_edit(self): |
| 364 | # Create a few temporary files |
| 365 | _, file1 = tempfile.mkstemp() |
| 366 | |
| 367 | with open(file1, "w", encoding="utf-8") as f: |
| 368 | f.write("one\ntwo\nthree\n") |
| 369 | |
| 370 | files = [file1] |
| 371 | |
| 372 | # Initialize the Coder object with the mocked IO and mocked repo |
| 373 | coder = Coder.create(self.GPT35, "diff", io=InputOutput(), fnames=files) |
| 374 | |
| 375 | def mock_send(*args, **kwargs): |
| 376 | coder.partial_response_content = f""" |
| 377 | Do this: |
| 378 | |
| 379 | {Path(file1).name} |
| 380 | <<<<<<< SEARCH |
| 381 | two |
| 382 | ======= |
| 383 | new |
| 384 | >>>>>>> REPLACE |
| 385 | |
| 386 | """ |
| 387 | coder.partial_response_function_call = dict() |
| 388 | return [] |
| 389 | |
| 390 | coder.send = mock_send |
| 391 | |
| 392 | # Call the run method with a message |
| 393 | coder.run(with_message="hi") |
| 394 | |
| 395 | content = Path(file1).read_text(encoding="utf-8") |
| 396 | self.assertEqual(content, "one\nnew\nthree\n") |
| 397 | |
| 398 | def test_full_edit_dry_run(self): |
| 399 | # Create a few temporary files |
nothing calls this directly
no test coverage detected