From 927b97bea17b54ce8647249f7464aa1d654334bb Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 5 Jul 2023 21:41:31 -0700 Subject: [PATCH] Added test1.py and test2.py files, dropped *2.py files, and checked if test1.py file is in the abs_fnames list. --- tests/test_commands.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 645281415..f3c93a58b 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -66,12 +66,17 @@ class TestCommands(TestCase): coder = Coder.create(models.GPT35, None, io, openai_api_key="deadbeef") commands = Commands(io, coder) + with open("test1.py", "w") as f: + f.write("print('test1')") + with open("test2.py", "w") as f: + f.write("print('test2')") + # Add some files to the chat session commands.cmd_add("*.py") # Call the cmd_drop method with a glob pattern - commands.cmd_drop("*.py") + commands.cmd_drop("*2.py") # Check if the Python files have been removed from the chat session - self.assertNotIn(os.path.abspath("test1.py"), coder.abs_fnames) + self.assertIn(os.path.abspath("test1.py"), coder.abs_fnames) self.assertNotIn(os.path.abspath("test2.py"), coder.abs_fnames)