Closed chisholm closed 2 years ago
Merging #534 (3086b7a) into master (81550ca) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #534 +/- ##
=======================================
Coverage 87.28% 87.29%
=======================================
Files 153 153
Lines 18025 18033 +8
=======================================
+ Hits 15734 15742 +8
Misses 2291 2291
Impacted Files | Coverage Δ | |
---|---|---|
stix2/test/test_pattern_equivalence.py | 100.00% <ø> (ø) |
|
stix2/equivalence/pattern/transform/comparison.py | 74.62% <100.00%> (+1.61%) |
:arrow_up: |
stix2/patterns.py | 62.01% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 81550ca...3086b7a. Read the comment docs.
Fixes #533 .
This PR fixes the comparison expression DNF transformer to catch the exception caused by inconsistent SCO types among comparison expression AND operands, and drop the AND expression. This resolves the problem and additionally enables a nice simplification. For example, the example from the issue was:
which would have transformed to:
The transformer will now drop the first, second, and fourth AND expressions due to their mixed SCO types (which means they'd be impossible to satisfy anyway). The result is simply:
which is semantically equivalent to the original: only a
b
SCO could have satisfied it, which is obvious in its simplified form.Also:
_dupe_ast()
in the comparison expression transformer module to dupe simple \_BooleanExpression
constructor to support an iterator for itsoperands
parameter. The old code implied the parameter value must support iteration over the values twice, which is not possible with an iterator. It was a very minor change.