Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork965
Description
git.types.assert_never is documented to raiseAssertionError ifraise_error isTrue andexc isNone:
Line 83 inb2c3d8b
| If raise_error is True, will also raise AssertionError or the Exception passed to exc. |
But it actually raisesValueError in this situation, its full implementation being:
Lines 85 to 89 inb2c3d8b
| ifraise_error: | |
| ifexcisNone: | |
| raiseValueError(f"An unhandled Literal ({inp}) in an if/else chain was found") | |
| else: | |
| raiseexc |
For comparison. there is anassert_never function in Python'styping module since 3.11 (and intyping_extensions). This function is similar but only has one parameter--which the first parameter ofgit.types.assert_never corresponds to--and it documentsthat it raises an exception if called at runtime, but does not document the type of exception raised. At least currently in Python 3.12,it raisesAssertionError.
The GitPython function is a public member ofgit.types, and it is used internally in GitPython. I don't know if the docstring should be fixed to describe the existing behavior, or if that behavior should itself be considered the bug here and changed to match the docstring.