(self)
| 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 | ``` |
| 260 | after a |
| 261 | ``` |
| 262 | |
| 263 | ### b.txt |
| 264 | ``` |
| 265 | after 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" |
nothing calls this directly
no test coverage detected