From 831a36ab3807a8a118a81bafea695fe709099ffa Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 23 May 2024 15:14:20 +0200 Subject: [PATCH 1/2] update pre-commits --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 321274a9..8faab34f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 From b3f18917ae9120da2909d86dadaafcd3372aff8e Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 23 May 2024 15:14:24 +0200 Subject: [PATCH 2/2] remove assert statement --- compliance_checker/base.py | 5 ++++- compliance_checker/suite.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compliance_checker/base.py b/compliance_checker/base.py index 933d5a5a..4cf5e751 100644 --- a/compliance_checker/base.py +++ b/compliance_checker/base.py @@ -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) diff --git a/compliance_checker/suite.py b/compliance_checker/suite.py index 60008488..a548aae7 100644 --- a/compliance_checker/suite.py +++ b/compliance_checker/suite.py @@ -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())