(self)
| 937 | self.assertIn("https://example.com", result) |
| 938 | |
| 939 | def test_coder_from_coder_with_subdir(self): |
| 940 | with GitTemporaryDirectory() as root: |
| 941 | repo = git.Repo.init(root) |
| 942 | |
| 943 | # Create a file in a subdirectory |
| 944 | subdir = Path(root) / "subdir" |
| 945 | subdir.mkdir() |
| 946 | test_file = subdir / "test_file.txt" |
| 947 | test_file.write_text("Test content") |
| 948 | |
| 949 | repo.git.add(str(test_file)) |
| 950 | repo.git.commit("-m", "Add test file") |
| 951 | |
| 952 | # Change directory to the subdirectory |
| 953 | os.chdir(subdir.resolve()) |
| 954 | |
| 955 | # Create the first coder |
| 956 | io = InputOutput(yes=True) |
| 957 | coder1 = Coder.create(self.GPT35, None, io=io, fnames=[test_file.name]) |
| 958 | |
| 959 | # Create a new coder from the first coder |
| 960 | coder2 = Coder.create(from_coder=coder1) |
| 961 | |
| 962 | # Check if both coders have the same set of abs_fnames |
| 963 | self.assertEqual(coder1.abs_fnames, coder2.abs_fnames) |
| 964 | |
| 965 | # Ensure the abs_fnames contain the correct absolute path |
| 966 | expected_abs_path = os.path.realpath(str(test_file)) |
| 967 | coder1_abs_fnames = set(os.path.realpath(path) for path in coder1.abs_fnames) |
| 968 | self.assertIn(expected_abs_path, coder1_abs_fnames) |
| 969 | self.assertIn(expected_abs_path, coder2.abs_fnames) |
| 970 | |
| 971 | # Check that the abs_fnames do not contain duplicate or incorrect paths |
| 972 | self.assertEqual(len(coder1.abs_fnames), 1) |
| 973 | self.assertEqual(len(coder2.abs_fnames), 1) |
| 974 | |
| 975 | def test_suggest_shell_commands(self): |
| 976 | with GitTemporaryDirectory(): |
nothing calls this directly
no test coverage detected