MCPcopy
hub / github.com/Aider-AI/aider / test_cmd_drop_without_glob

Method test_cmd_drop_without_glob

tests/basic/test_commands.py:296–326  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

294 self.assertEqual(len(coder.abs_fnames), initial_count - 1)
295
296 def test_cmd_drop_without_glob(self):
297 # Initialize the Commands and InputOutput objects
298 io = InputOutput(pretty=False, fancy_input=False, yes=True)
299 from aider.coders import Coder
300
301 coder = Coder.create(self.GPT35, None, io)
302 commands = Commands(io, coder)
303
304 # Create test files
305 test_files = ["file1.txt", "file2.txt", "file3.py"]
306 for fname in test_files:
307 Path(fname).touch()
308
309 # Add all files to the chat session
310 for fname in test_files:
311 commands.cmd_add(fname)
312
313 initial_count = len(coder.abs_fnames)
314 self.assertEqual(initial_count, 3)
315
316 # Test dropping individual files without glob
317 commands.cmd_drop("file1.txt")
318 self.assertNotIn(str(Path("file1.txt").resolve()), coder.abs_fnames)
319 self.assertIn(str(Path("file2.txt").resolve()), coder.abs_fnames)
320 self.assertEqual(len(coder.abs_fnames), initial_count - 1)
321
322 # Test dropping multiple files without glob
323 commands.cmd_drop("file2.txt file3.py")
324 self.assertNotIn(str(Path("file2.txt").resolve()), coder.abs_fnames)
325 self.assertNotIn(str(Path("file3.py").resolve()), coder.abs_fnames)
326 self.assertEqual(len(coder.abs_fnames), 0)
327
328 def test_cmd_add_bad_encoding(self):
329 # Initialize the Commands and InputOutput objects

Callers

nothing calls this directly

Calls 5

cmd_addMethod · 0.95
cmd_dropMethod · 0.95
InputOutputClass · 0.90
CommandsClass · 0.90
createMethod · 0.80

Tested by

no test coverage detected