(self)
| 406 | ) |
| 407 | |
| 408 | def test_get_file_mentions_path_formats(self): |
| 409 | with GitTemporaryDirectory(): |
| 410 | io = InputOutput(pretty=False, yes=True) |
| 411 | coder = Coder.create(self.GPT35, None, io) |
| 412 | |
| 413 | # Test cases with different path formats |
| 414 | test_cases = [ |
| 415 | # Unix paths in content, Unix paths in get_addable_relative_files |
| 416 | ("Check file1.txt and dir/file2.txt", ["file1.txt", "dir/file2.txt"]), |
| 417 | # Windows paths in content, Windows paths in get_addable_relative_files |
| 418 | ("Check file1.txt and dir\\file2.txt", ["file1.txt", "dir\\file2.txt"]), |
| 419 | # Unix paths in content, Windows paths in get_addable_relative_files |
| 420 | ("Check file1.txt and dir/file2.txt", ["file1.txt", "dir\\file2.txt"]), |
| 421 | # Windows paths in content, Unix paths in get_addable_relative_files |
| 422 | ("Check file1.txt and dir\\file2.txt", ["file1.txt", "dir/file2.txt"]), |
| 423 | # Mixed paths in content, Unix paths in get_addable_relative_files |
| 424 | ( |
| 425 | "Check file1.txt, dir/file2.txt, and other\\file3.txt", |
| 426 | ["file1.txt", "dir/file2.txt", "other/file3.txt"], |
| 427 | ), |
| 428 | # Mixed paths in content, Windows paths in get_addable_relative_files |
| 429 | ( |
| 430 | "Check file1.txt, dir/file2.txt, and other\\file3.txt", |
| 431 | ["file1.txt", "dir\\file2.txt", "other\\file3.txt"], |
| 432 | ), |
| 433 | ] |
| 434 | |
| 435 | for content, addable_files in test_cases: |
| 436 | with self.subTest(content=content, addable_files=addable_files): |
| 437 | coder.get_addable_relative_files = MagicMock(return_value=set(addable_files)) |
| 438 | mentioned_files = coder.get_file_mentions(content) |
| 439 | expected_files = set(addable_files) |
| 440 | self.assertEqual( |
| 441 | mentioned_files, |
| 442 | expected_files, |
| 443 | f"Failed for content: {content}, addable_files: {addable_files}", |
| 444 | ) |
| 445 | |
| 446 | def test_run_with_file_deletion(self): |
| 447 | # Create a few temporary files |
nothing calls this directly
no test coverage detected