MCPcopy
hub / github.com/Aider-AI/aider / test_check_for_filename_mentions

Method test_check_for_filename_mentions

tests/basic/test_coder.py:122–152  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

120 self.assertIn("file2.txt", content)
121
122 def test_check_for_filename_mentions(self):
123 with GitTemporaryDirectory():
124 repo = git.Repo()
125
126 mock_io = MagicMock()
127
128 fname1 = Path("file1.txt")
129 fname2 = Path("file2.py")
130
131 fname1.write_text("one\n")
132 fname2.write_text("two\n")
133
134 repo.git.add(str(fname1))
135 repo.git.add(str(fname2))
136 repo.git.commit("-m", "new")
137
138 # Initialize the Coder object with the mocked IO and mocked repo
139 coder = Coder.create(self.GPT35, None, mock_io)
140
141 # Call the check_for_file_mentions method
142 coder.check_for_file_mentions("Please check file1.txt and file2.py")
143
144 # Check if coder.abs_fnames contains both files
145 expected_files = set(
146 [
147 str(Path(coder.root) / fname1),
148 str(Path(coder.root) / fname2),
149 ]
150 )
151
152 self.assertEqual(coder.abs_fnames, expected_files)
153
154 def test_check_for_ambiguous_filename_mentions_of_longer_paths(self):
155 with GitTemporaryDirectory():

Callers

nothing calls this directly

Calls 5

write_textMethod · 0.80
commitMethod · 0.80
createMethod · 0.80

Tested by

no test coverage detected