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

Method test_run_with_file_unicode_error

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

Source from the content-addressed store, hash-verified

477 self.assertEqual(len(coder.abs_fnames), 1)
478
479 def test_run_with_file_unicode_error(self):
480 # Create a few temporary files
481 _, file1 = tempfile.mkstemp()
482 _, file2 = tempfile.mkstemp()
483
484 files = [file1, file2]
485
486 # Initialize the Coder object with the mocked IO and mocked repo
487 coder = Coder.create(self.GPT35, None, io=InputOutput(), fnames=files)
488
489 def mock_send(*args, **kwargs):
490 coder.partial_response_content = "ok"
491 coder.partial_response_function_call = dict()
492 return []
493
494 coder.send = mock_send
495
496 # Call the run method with a message
497 coder.run(with_message="hi")
498 self.assertEqual(len(coder.abs_fnames), 2)
499
500 # Write some non-UTF8 text into the file
501 with open(file1, "wb") as f:
502 f.write(b"\x80abc")
503
504 # Call the run method again with a message
505 coder.run(with_message="hi")
506 self.assertEqual(len(coder.abs_fnames), 1)
507
508 def test_choose_fence(self):
509 # Create a few temporary files

Callers

nothing calls this directly

Calls 3

InputOutputClass · 0.90
createMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected