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

Method test_update_hash_filename

tests/basic/test_wholefile.py:249–285  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

247 self.assertEqual(fname_b.read_text(), "after b\n")
248
249 def test_update_hash_filename(self):
250 fname_a = Path("a.txt")
251 fname_b = Path("b.txt")
252
253 fname_a.write_text("before a\n")
254 fname_b.write_text("before b\n")
255
256 response = """
257
258### a.txt
259```
260after a
261```
262
263### b.txt
264```
265after b
266```
267"""
268 # Initialize WholeFileCoder with the temporary directory
269 io = InputOutput(yes=True)
270 coder = WholeFileCoder(main_model=self.GPT35, io=io, fnames=[fname_a, fname_b])
271
272 # Set the partial response content with the updated content
273 coder.partial_response_content = response
274
275 # Call update_files method
276 edited_files = coder.apply_updates()
277
278 dump(edited_files)
279
280 # Check if the sample file was updated
281 self.assertIn(str(fname_a), edited_files)
282 self.assertIn(str(fname_b), edited_files)
283
284 self.assertEqual(fname_a.read_text(), "after a\n")
285 self.assertEqual(fname_b.read_text(), "after b\n")
286
287 def test_update_named_file_but_extra_unnamed_code_block(self):
288 sample_file = "hello.py"

Callers

nothing calls this directly

Calls 6

InputOutputClass · 0.90
WholeFileCoderClass · 0.90
dumpFunction · 0.90
write_textMethod · 0.80
apply_updatesMethod · 0.80
read_textMethod · 0.45

Tested by

no test coverage detected