Skip to content

Commit

Permalink
add test for bad formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnzZ committed Jul 4, 2024
1 parent 904f42f commit 60dba3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def test_rule_validity():
for path in RULE_PATHS:
try:
with open(path, "r") as f:
data = json.loads(f.read())
raw_text = f.read()
data = json.loads(raw_text)
except Exception as e:
raise ValueError(f"Something went wrong when reading '{path}': {str(e)}.")

Expand All @@ -32,3 +33,7 @@ def test_rule_validity():

if "args" in rule:
assert isinstance(rule["args"], (list, tuple))

assert (
json.dumps(data, indent=2, sort_keys=True) == raw_text.rstrip()
), f"Check {path} for formatting issue"

0 comments on commit 60dba3a

Please sign in to comment.