(self)
| 69 | self.assertEqual(edit[1], ["-Original\n", "+Modified\n"]) |
| 70 | |
| 71 | def test_find_multi_diffs(self): |
| 72 | content = """ |
| 73 | To implement the `--check-update` option, I will make the following changes: |
| 74 | |
| 75 | 1. Add the `--check-update` argument to the argument parser in `aider/main.py`. |
| 76 | 2. Modify the `check_version` function in `aider/versioncheck.py` to return a boolean indicating whether an update is available. |
| 77 | 3. Use the returned value from `check_version` in `aider/main.py` to set the exit status code when `--check-update` is used. |
| 78 | |
| 79 | Here 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 | |
| 109 | These 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 | |
| 118 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected