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
Description: The word_error_rate function does not handle cases where an invalid keyword argument is passed. For example, if the user accidentally types norm="truthx" instead of norm="truth", the function will not raise an error. Instead, it will simply ignore the invalid keyword argument and use the default value.
Expected behavior: The function should raise a ValueError or TypeError when an invalid keyword argument is passed.
Fix: Add exception handling to the word_error_rate function to raise an error when an invalid keyword argument is passed.
Stub how this could be changed.
defword_error_rate(truth, prediction, **kwargs):
if"norm"inkwargsandkwargs["norm"] notin ["truth", "longest"]:
raiseValueError(f"Invalid value for 'norm': {kwargs['norm']}")
# ... rest of the function ...
This fix will ensure that the function raises an error when
an invalid keyword argument is passed, making it easier for users to catch and fix typos.
Description: The word_error_rate function does not handle cases where an invalid keyword argument is passed. For example, if the user accidentally types norm="truthx" instead of norm="truth", the function will not raise an error. Instead, it will simply ignore the invalid keyword argument and use the default value.
Expected behavior: The function should raise a ValueError or TypeError when an invalid keyword argument is passed.
Example Test:
Fix: Add exception handling to the word_error_rate function to raise an error when an invalid keyword argument is passed.
Stub how this could be changed.
This fix will ensure that the function raises an error when
an invalid keyword argument is passed, making it easier for users to catch and fix typos.
/cc @hagenw
The text was updated successfully, but these errors were encountered: