Matching re-occuring value within patterns #58
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.
We propose a solution to evaluate our so called inter-observable patterns described in Issue #57.
I will try to describe what our code changes do:
exitPropTestRegex
-function. Whenever a regex containing a variable is successfully matched against an Observable object, we store the variable name, Observable ID and actual value the variable matched on in a nested dictionary (interobs_group_matches
). Example: we have the pattern[file:name MATCHES '(?P<var>[a-z]{3})]
, a File-Observable with filename 'foo' and one with filename 'bar'.interobs_group_matches
will look like this:{'var': {0: ['foo'], 1: ['bar']}}
.interobs_group_matches
and remove all values of irrelevant SDOs. Then run the checks on this copy. If a check returnsfalse
, remove the current binding fromfound_bindings
-- it does not fulfill the inter-observable pattern.Our changes to the code are as transparent as possible to the original functionality of the matcher. We also added a small test to evaluate the functionality of inter-observable patterns.