(self)
| 444 | ) |
| 445 | |
| 446 | def test_run_with_file_deletion(self): |
| 447 | # Create a few temporary files |
| 448 | |
| 449 | tempdir = Path(tempfile.mkdtemp()) |
| 450 | |
| 451 | file1 = tempdir / "file1.txt" |
| 452 | file2 = tempdir / "file2.txt" |
| 453 | |
| 454 | file1.touch() |
| 455 | file2.touch() |
| 456 | |
| 457 | files = [file1, file2] |
| 458 | |
| 459 | # Initialize the Coder object with the mocked IO and mocked repo |
| 460 | coder = Coder.create(self.GPT35, None, io=InputOutput(), fnames=files) |
| 461 | |
| 462 | def mock_send(*args, **kwargs): |
| 463 | coder.partial_response_content = "ok" |
| 464 | coder.partial_response_function_call = dict() |
| 465 | return [] |
| 466 | |
| 467 | coder.send = mock_send |
| 468 | |
| 469 | # Call the run method with a message |
| 470 | coder.run(with_message="hi") |
| 471 | self.assertEqual(len(coder.abs_fnames), 2) |
| 472 | |
| 473 | file1.unlink() |
| 474 | |
| 475 | # Call the run method again with a message |
| 476 | coder.run(with_message="hi") |
| 477 | self.assertEqual(len(coder.abs_fnames), 1) |
| 478 | |
| 479 | def test_run_with_file_unicode_error(self): |
| 480 | # Create a few temporary files |
nothing calls this directly
no test coverage detected