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

Method test_allowed_to_edit

tests/basic/test_coder.py:25–52  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

23 self.mock_webbrowser = self.webbrowser_patcher.start()
24
25 def test_allowed_to_edit(self):
26 with GitTemporaryDirectory():
27 repo = git.Repo()
28
29 fname = Path("added.txt")
30 fname.touch()
31 repo.git.add(str(fname))
32
33 fname = Path("repo.txt")
34 fname.touch()
35 repo.git.add(str(fname))
36
37 repo.git.commit("-m", "init")
38
39 # YES!
40 # Use a completely mocked IO object instead of a real one
41 io = MagicMock()
42 io.confirm_ask = MagicMock(return_value=True)
43 coder = Coder.create(self.GPT35, None, io, fnames=["added.txt"])
44
45 self.assertTrue(coder.allowed_to_edit("added.txt"))
46 self.assertTrue(coder.allowed_to_edit("repo.txt"))
47 self.assertTrue(coder.allowed_to_edit("new.txt"))
48
49 self.assertIn("repo.txt", str(coder.abs_fnames))
50 self.assertIn("new.txt", str(coder.abs_fnames))
51
52 self.assertFalse(coder.need_commit_before_edits)
53
54 def test_allowed_to_edit_no(self):
55 with GitTemporaryDirectory():

Callers

nothing calls this directly

Calls 4

commitMethod · 0.80
createMethod · 0.80
allowed_to_editMethod · 0.80

Tested by

no test coverage detected