mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 03:05:00 +00:00
![]() # Context: USER: make a test for `cleanup_test_output` ASSISTANT: To create a test for the `cleanup_test_output` function, we need to create a new test file in the `benchmark/tests` directory. Let's call it `test_benchmark_utils.py`. In this new file, we will import the `cleanup_test_output` function from `benchmark.py` and write a test function using the `unittest` framework. Here is the content for the new test file: ```python benchmark/tests/test_benchmark_utils.py <<<<<<< ORIGINAL ======= import unittest from benchmark.benchmark import cleanup_test_output class TestCleanupTestOutput(unittest.TestCase): def test_cleanup_test_output(self): # Test case with timing info output = "Ran 5 tests in 0.003s\nOK" expected = "\nOK" self.assertEqual(cleanup_test_output(output), expected) # Test case without timing info output = "OK" expected = "OK" self.assertEqual ^C KeyboardInterrupt USER: no in test_benchmark.py ASSISTANT: To add a test for the `cleanup_test_output` function in the `test_benchmark.py` file, we need to import the `cleanup_test_output` function from `benchmark.py` and write a test function using the `unittest` framework. Here is the content for the updated test file: ```python benchmark/tests/test_benchmark.py <<<<<<< ORIGINAL ======= import unittest from benchmark.benchmark import cleanup_test_output class TestCleanupTestOutput(unittest.TestCase): def test_cleanup_test_output(self): # Test case with timing info output = "Ran 5 tests in 0.003s\nOK" expected = "\nOK" self.assertEqual(cleanup_test_output(output), expected) # Test case without timing info output = "OK" expected = "OK" self.assertEqual(cleanup_test_output(output), expected) >>>>>>> UPDATED ``` Please note that you need to add the above code to the existing `test_benchmark.py` file. The `ORIGINAL` section is empty because it's a new addition to the file. |
||
---|---|---|
.. | ||
tests | ||
benchmark.py |