Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing exception raise in _val_is_numeric() and _val_is_str() #510

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions great_tables/_utils_nanoplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _val_is_numeric(x: Any) -> bool:

# If a list then signal a failure
if isinstance(x, list):
ValueError("The input cannot be a list. It must be a single value.")
raise ValueError("The input cannot be a list. It must be a single value.")

return isinstance(x, (int, float))

Expand All @@ -38,7 +38,7 @@ def _val_is_str(x: Any) -> bool:

# If a list then signal a failure
if isinstance(x, list):
ValueError("The input cannot be a list. It must be a single value.")
raise ValueError("The input cannot be a list. It must be a single value.")

return isinstance(x, (str))

Expand Down
2 changes: 0 additions & 2 deletions tests/test__utils_nanoplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def test_val_is_numeric():
assert not _val_is_numeric("a")


@pytest.mark.xfail
def test_val_is_numeric_fails_list_input():
with pytest.raises(ValueError):
_val_is_numeric([1, 2, 3])
Expand All @@ -88,7 +87,6 @@ def test_val_is_str():
assert not _val_is_str(1)


@pytest.mark.xfail
def test_val_is_str_fails_list_input():
with pytest.raises(ValueError):
_val_is_str(["a", "b", "c"])
Expand Down