Skip to content

Commit

Permalink
Add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Aug 14, 2024
1 parent 43a00e5 commit 28776e5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_dsl_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
)
from tested.testsuite import (
CustomCheckOracle,
FileOutputChannel,
FileUrl,
GenericTextOracle,
GenericValueOracle,
Expand Down Expand Up @@ -657,6 +658,37 @@ def test_value_built_in_checks_implied():
)


def test_file_custom_check_correct():
yaml_str = f"""
- tab: 'Test'
contexts:
- testcases:
- statement: 'test()'
file:
content: "test/hallo.txt"
oracle: "custom_check"
location: "test.txt"
name: "evaluate_test"
file: "test.py"
"""
json_str = translate_to_test_suite(yaml_str)
suite = parse_test_suite(json_str)
assert len(suite.tabs) == 1
tab = suite.tabs[0]
assert len(tab.contexts) == 1
testcases = tab.contexts[0].testcases
assert len(testcases) == 1
test = testcases[0]
assert isinstance(test.input, FunctionCall)
assert isinstance(test.output.file, FileOutputChannel)
assert isinstance(test.output.file.oracle, CustomCheckOracle)
assert test.output.file.actual_path == "test.txt"
assert test.output.file.expected_path == "test/hallo.txt"
oracle = test.output.file.oracle
assert oracle.function.name == "evaluate_test"
assert oracle.function.file == Path("test.py")


def test_value_built_in_checks_explicit():
yaml_str = f"""
- tab: 'Test'
Expand Down

0 comments on commit 28776e5

Please sign in to comment.