Skip to content

Commit

Permalink
addressed the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Nargis Sultani committed Sep 12, 2023
1 parent 44612d8 commit 8285ca5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/tests/test_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pytest

from validator.checks import SBLCheck


class TestSBLCheck:
def test_no_id_check(self):
with pytest.raises(Exception) as exc:
SBLCheck(lambda: True, warning=True, name="Just a Warning")

assert "Each check must be assigned a `name` and an `id`." in str(exc.value)
assert exc.type == ValueError

def test_no_name_check(self):
with pytest.raises(Exception) as exc:
SBLCheck(lambda: True, id="00000", warning=True)

assert "Each check must be assigned a `name` and an `id`." in str(exc.value)
assert exc.type == ValueError

def test_name_and_id_check(self):
raised = False
try:
SBLCheck(lambda: True, id="00000", warning=True, name="Just a Warning")
except ValueError:
raised = True
assert raised is False

0 comments on commit 8285ca5

Please sign in to comment.