Operators for chained tests -- Fix #46 #178
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #46
Glossary:
ETC: Elementary test conditionAs proposed here, the grammar is as follows
where
exp -> catA-op exp exp | catB-op ETC
catA-op -> AND | OR
catB-op -> NOT | epsilon
This grammar translates to the following example in yaml syntax:
AND, ORare binary operators andNOTis a unary operator.If any deviation is observed, for ex, passing more than one ETC to a unary operator or passing one ETC to a binary operator, the parser will simply ignore that instance and continue evaluating remaining sub-expressions.
If all sub-expressions are skipped then no ETCs are executed. For module version, this means that Operator.result will now be
Noneinstead of earlierTrue.Changes to reporting:
Reporting works exactly as previously, nothing is removed only new things are added.
Now, each test's status is also shown in the final report.
For module version, one can access the new Operator.result_dict dictionary (
key => test_name, value=> result[True/False/None])to access the result of each test. User should ensure that test names in a test suite remain unique. If they repeat the result of older instance gets overwritten.Also please note that one should not confuse the no. of test cases passed or fail reported at the end with the no. of sub-expressions failed or passed.
Example 1:
test.yml:
Output:
Notice the error produced due to the malformed
NOTsub-expression. The parser skipped the incorrect part and executed the rest ETCs and sub-expressions. As 3 of the ETCs were passed, the no of tests passed is reported to be so.One thing to note: In cases where during the course of sub-expression evaluation, the number of valid sub-expressions drops below two for any of the binary operator, the operator will be rendered ineffective as
is meaningless. The ETC in question (
- is-equal: local-address, unspecifiedhere ) will then become part of list of the parent operator.Example 2:
test.yml
Output
Example 3:
test.yml
Output
Example 4:
test.yml
Output