Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gonz102 committed Jul 29, 2024
1 parent 6caba0d commit 9d4113f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
4 changes: 3 additions & 1 deletion rct229/ruletest_engine/ruletest_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ def process_test_result(test_result, test_dict, test_id):
return outcome_text, received_expected_outcome


def run_section_tests(test_json_name: str, ruleset_doc: RuleSet, test_json_path: Optional[str] = None):
def run_section_tests(
test_json_name: str, ruleset_doc: RuleSet, test_json_path: Optional[str] = None
):
"""Runs all tests found in a given test JSON and prints results to console. Returns true/false describing whether
or not all tests in the JSON result in the expected outcome.
Expand Down
42 changes: 18 additions & 24 deletions rct229/ruletest_engine/tests/test_ruletest_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,54 @@
from rct229.rule_engine.rulesets import RuleSet
from rct229.ruletest_engine.ruletest_engine import run_section_tests


def test__ruletest_engine__all_pass():

test_json_name = 'test_engine_dict_test_file_all_pass.json'
test_json_name = "test_engine_dict_test_file_all_pass.json"
ruleset_doc = RuleSet.ASHRAE9012019_RULESET
test_json_path = os.path.join(
os.path.dirname(__file__), "test_files"
)
test_json_path = os.path.join(os.path.dirname(__file__), "test_files")

assert run_section_tests(test_json_name, ruleset_doc, test_json_path)


def test__ruletest_engine__incorrect_pass():

test_json_name = 'test_engine_dict_test_file_incorrect_fail.json'
test_json_name = "test_engine_dict_test_file_incorrect_fail.json"
ruleset_doc = RuleSet.ASHRAE9012019_RULESET
test_json_path = os.path.join(
os.path.dirname(__file__), "test_files"
)
test_json_path = os.path.join(os.path.dirname(__file__), "test_files")

assert not run_section_tests(test_json_name, ruleset_doc, test_json_path)


def test__ruletest_engine__incorrect_failure():

test_json_name = 'test_engine_dict_test_file_incorrect_pass.json'
test_json_name = "test_engine_dict_test_file_incorrect_pass.json"
ruleset_doc = RuleSet.ASHRAE9012019_RULESET
test_json_path = os.path.join(
os.path.dirname(__file__), "test_files"
)
test_json_path = os.path.join(os.path.dirname(__file__), "test_files")

assert not run_section_tests(test_json_name, ruleset_doc, test_json_path)


def test__ruletest_engine__incorrect_undetermined():
test_json_name = 'test_engine_dict_test_file_incorrect_undetermined.json'
test_json_name = "test_engine_dict_test_file_incorrect_undetermined.json"
ruleset_doc = RuleSet.ASHRAE9012019_RULESET
test_json_path = os.path.join(
os.path.dirname(__file__), "test_files"
)
test_json_path = os.path.join(os.path.dirname(__file__), "test_files")

assert not run_section_tests(test_json_name, ruleset_doc, test_json_path)


def test__ruletest_engine__incorrect_not_applicable():
test_json_name = 'test_engine_dict_test_file_incorrect_not_applicable.json'
test_json_name = "test_engine_dict_test_file_incorrect_not_applicable.json"
ruleset_doc = RuleSet.ASHRAE9012019_RULESET
test_json_path = os.path.join(
os.path.dirname(__file__), "test_files"
)
test_json_path = os.path.join(os.path.dirname(__file__), "test_files")

assert not run_section_tests(test_json_name, ruleset_doc, test_json_path)


def test__ruletest_engine__missing_expected_outcome(capfd):
test_json_name = 'test_engine_dict_test_file_missing_expected_outcome.json'
test_json_name = "test_engine_dict_test_file_missing_expected_outcome.json"
ruleset_doc = RuleSet.ASHRAE9012019_RULESET
test_json_path = os.path.join(
os.path.dirname(__file__), "test_files"
)
test_json_path = os.path.join(os.path.dirname(__file__), "test_files")

assert not run_section_tests(test_json_name, ruleset_doc, test_json_path)

Expand Down

0 comments on commit 9d4113f

Please sign in to comment.