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

Method test_find_multi_diffs

tests/basic/test_udiff.py:71–115  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

69 self.assertEqual(edit[1], ["-Original\n", "+Modified\n"])
70
71 def test_find_multi_diffs(self):
72 content = """
73To implement the `--check-update` option, I will make the following changes:
74
751. Add the `--check-update` argument to the argument parser in `aider/main.py`.
762. Modify the `check_version` function in `aider/versioncheck.py` to return a boolean indicating whether an update is available.
773. Use the returned value from `check_version` in `aider/main.py` to set the exit status code when `--check-update` is used.
78
79Here are the diffs for those changes:
80
81```diff
82--- aider/versioncheck.py
83+++ aider/versioncheck.py
84@@ ... @@
85 except Exception as err:
86 print_cmd(f"Error checking pypi for new version: {err}")
87+ return False
88
89--- aider/main.py
90+++ aider/main.py
91@@ ... @@
92 other_group.add_argument(
93 "--version",
94 action="version",
95 version=f"%(prog)s {__version__}",
96 help="Show the version number and exit",
97 )
98+ other_group.add_argument(
99+ "--check-update",
100+ action="store_true",
101+ help="Check for updates and return status in the exit code",
102+ default=False,
103+ )
104 other_group.add_argument(
105 "--apply",
106 metavar="FILE",
107```
108
109These changes will add the `--check-update` option to the command-line interface and use the `check_version` function to determine if an update is available, exiting with status code `0` if no update is available and `1` if an update is available.
110""" # noqa: E501
111
112 edits = find_diffs(content)
113 dump(edits)
114 self.assertEqual(len(edits), 2)
115 self.assertEqual(len(edits[0][1]), 3)
116
117
118if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

find_diffsFunction · 0.90
dumpFunction · 0.90

Tested by

no test coverage detected