From 52a9df5b343f230e63a4dfea45fa33b8f365e1d0 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 27 May 2023 18:07:52 -0700 Subject: [PATCH] aider: Added a test function to check if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set. # Context: USER: add a test for NO_COLOR ASSISTANT: To add a test for the `NO_COLOR` environment variable, we will create a new test function in the `tests/test_io.py` file. Since this file does not exist, we will create it first. ```python tests/test_io.py <<<<<<< ORIGINAL ======= import os import unittest from unittest.mock import patch from aider.io import InputOutput class TestInputOutput(unittest.TestCase): def test_no_color_environment_variable(self): with patch.dict(os.environ, {"NO_COLOR": "1"}): io = InputOutput() self.assertFalse(io.pretty) if __name__ == "__main__": unittest.main() >>>>>>> UPDATED ``` This test function checks if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set. --- tests/test_io.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/test_io.py diff --git a/tests/test_io.py b/tests/test_io.py new file mode 100644 index 000000000..4a51bcd0d --- /dev/null +++ b/tests/test_io.py @@ -0,0 +1,13 @@ +import os +import unittest +from unittest.mock import patch +from aider.io import InputOutput + +class TestInputOutput(unittest.TestCase): + def test_no_color_environment_variable(self): + with patch.dict(os.environ, {"NO_COLOR": "1"}): + io = InputOutput() + self.assertFalse(io.pretty) + +if __name__ == "__main__": + unittest.main()