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

Method test_cmd_drop_with_glob_patterns

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

Source from the content-addressed store, hash-verified

265 self.assertNotIn(abs_fname, coder.abs_fnames)
266
267 def test_cmd_drop_with_glob_patterns(self):
268 # Initialize the Commands and InputOutput objects
269 io = InputOutput(pretty=False, fancy_input=False, yes=True)
270 from aider.coders import Coder
271
272 coder = Coder.create(self.GPT35, None, io)
273 commands = Commands(io, coder)
274
275 # Create test files in root and subdirectory
276 subdir = Path("subdir")
277 subdir.mkdir()
278 (subdir / "subtest1.py").touch()
279 (subdir / "subtest2.py").touch()
280
281 Path("test1.py").touch()
282 Path("test2.py").touch()
283 Path("test3.txt").touch()
284
285 # Add all Python files to the chat session
286 commands.cmd_add("*.py")
287 initial_count = len(coder.abs_fnames)
288 self.assertEqual(initial_count, 2) # Only root .py files should be added
289
290 # Test dropping with glob pattern
291 commands.cmd_drop("*2.py")
292 self.assertIn(str(Path("test1.py").resolve()), coder.abs_fnames)
293 self.assertNotIn(str(Path("test2.py").resolve()), coder.abs_fnames)
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

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