Added test1.py and test2.py files, dropped *2.py files, and checked if test1.py file is in the abs_fnames list.

This commit is contained in:
Paul Gauthier 2023-07-05 21:41:31 -07:00
parent 7f76559e6c
commit 927b97bea1

View file

@ -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)