From 5444b45a938d4a9fd5115e2c62566fbe5b06d5ee Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 May 2023 22:08:30 -0700 Subject: [PATCH] aider: Added test for ValueError containing the word "Incomplete" in `test_find_original_update_blocks_unclosed`. # Context: USER: in test_find_original_update_blocks_unclosed, assert that it throws a valueerror containing the word "Incomplete" ASSISTANT: To add the test for ValueError containing the word "Incomplete" in the `test_find_original_update_blocks_unclosed` function, you can use the `assertRaises` context manager and check if the exception message contains the word "Incomplete". Here's the change: ```python tests/test_utils.py <<<<<<< ORIGINAL utils.find_original_update_blocks(edit) ======= with self.assertRaises(ValueError) as cm: utils.find_original_update_blocks(edit) self.assertIn("Incomplete", str(cm.exception)) >>>>>>> UPDATED ``` --- tests/test_utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 96c678ec5..631e698fa 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -60,6 +60,25 @@ Hope you like it! edits = list(utils.find_original_update_blocks(edit)) self.assertEqual(edits, [("foo.txt", "Two\n", "Tooooo\n")]) + def test_find_original_update_blocks_unclosed(self): + edit = """ +Here's the change: + +```text +foo.txt +<<<<<<< ORIGINAL +Two +======= +Tooooo + + +oops! +""" + + with self.assertRaises(ValueError) as cm: + utils.find_original_update_blocks(edit) + self.assertIn("Incomplete", str(cm.exception)) + if __name__ == "__main__": unittest.main()