(self)
| 52 | self.assertFalse(coder.need_commit_before_edits) |
| 53 | |
| 54 | def test_allowed_to_edit_no(self): |
| 55 | with GitTemporaryDirectory(): |
| 56 | repo = git.Repo() |
| 57 | |
| 58 | fname = Path("added.txt") |
| 59 | fname.touch() |
| 60 | repo.git.add(str(fname)) |
| 61 | |
| 62 | fname = Path("repo.txt") |
| 63 | fname.touch() |
| 64 | repo.git.add(str(fname)) |
| 65 | |
| 66 | repo.git.commit("-m", "init") |
| 67 | |
| 68 | # say NO |
| 69 | io = InputOutput(yes=False) |
| 70 | |
| 71 | coder = Coder.create(self.GPT35, None, io, fnames=["added.txt"]) |
| 72 | |
| 73 | self.assertTrue(coder.allowed_to_edit("added.txt")) |
| 74 | self.assertFalse(coder.allowed_to_edit("repo.txt")) |
| 75 | self.assertFalse(coder.allowed_to_edit("new.txt")) |
| 76 | |
| 77 | self.assertNotIn("repo.txt", str(coder.abs_fnames)) |
| 78 | self.assertNotIn("new.txt", str(coder.abs_fnames)) |
| 79 | |
| 80 | self.assertFalse(coder.need_commit_before_edits) |
| 81 | |
| 82 | def test_allowed_to_edit_dirty(self): |
| 83 | with GitTemporaryDirectory(): |
nothing calls this directly
no test coverage detected