Skip to content

Commit

Permalink
Merge pull request #1083 from ocefpaf/remove_assert_statement
Browse files Browse the repository at this point in the history
Remove assert statement
  • Loading branch information
benjwadams authored May 23, 2024
2 parents 48747c5 + b3f1891 commit 4b68576
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repos:


- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
rev: v0.4.5
hooks:
- id: ruff

Expand Down
5 changes: 4 additions & 1 deletion compliance_checker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ def __init__(
if value is None:
self.value = None
elif isinstance(value, tuple):
assert len(value) == 2, "Result value must be 2-tuple or boolean!"
if len(value) != 2:
raise ValueError(
f"Result value must be 2-tuple or boolean! Got {value}",
)
self.value = value
else:
self.value = bool(value)
Expand Down
3 changes: 2 additions & 1 deletion compliance_checker/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def _get_valid_checkers(self, ds, checker_names):
the user selected names.
"""

assert len(self.checkers) > 0, "No checkers could be found."
if len(self.checkers) <= 0:
raise ValueError("No checkers could be found.")

if len(checker_names) == 0:
checker_names = list(self.checkers.keys())
Expand Down

0 comments on commit 4b68576

Please sign in to comment.