You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseValueError(f"An unhandled Literal ({inp}) in an if/else chain was found")
else:
raiseexc
For comparison. there is an assert_never function in Python's typing module since 3.11 (and in typing_extensions). This function is similar but only has one parameter--which the first parameter of git.types.assert_never corresponds to--and it documents that 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 raises AssertionError.
The GitPython function is a public member of git.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.
The text was updated successfully, but these errors were encountered:
It does seem a bit strange to me that functions related to testing are part of the git public API in the first place, but it's probably nothing that can truly be fixed anymore.
With that said, even tough there mere existence could be considered a bug, I tend to leave it and its behaviour alone while fixing the docstring.
git.types.assert_never
is documented to raiseAssertionError
ifraise_error
isTrue
andexc
isNone
:GitPython/git/types.py
Line 83 in b2c3d8b
But it actually raises
ValueError
in this situation, its full implementation being:GitPython/git/types.py
Lines 85 to 89 in b2c3d8b
For comparison. there is an
assert_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 documents that 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 of
git.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.The text was updated successfully, but these errors were encountered: