From fa80d2f3cc8142950329e73dc4801fa001f69d84 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 13 Jan 2025 09:36:26 -0800 Subject: [PATCH] test: add line endings validation tests for InputOutput --- tests/basic/test_io.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/basic/test_io.py b/tests/basic/test_io.py index d6762df93..5f56a278a 100644 --- a/tests/basic/test_io.py +++ b/tests/basic/test_io.py @@ -12,6 +12,18 @@ from aider.utils import ChdirTemporaryDirectory class TestInputOutput(unittest.TestCase): + def test_line_endings_validation(self): + # Test valid line endings + for ending in ["platform", "lf", "crlf"]: + io = InputOutput(line_endings=ending) + self.assertEqual(io.newline, None if ending == "platform" else "\n" if ending == "lf" else "\r\n") + + # Test invalid line endings + with self.assertRaises(ValueError) as cm: + io = InputOutput(line_endings="invalid") + self.assertIn("Invalid line_endings value: invalid", str(cm.exception)) + self.assertIn("Must be one of: platform, lf, crlf", str(cm.exception)) + def test_no_color_environment_variable(self): with patch.dict(os.environ, {"NO_COLOR": "1"}): io = InputOutput(fancy_input=False)