@@ -56,22 +56,11 @@ def get_value(output: Union[Mapping, List], path: str = "*", exclude: List = Non
56
56
Returns:
57
57
Evaluated data, may be anything depending on JMESPath used.
58
58
"""
59
-
60
- def assert_filter_definition ():
61
- """
62
- Assert exclude filter definition in check.
63
-
64
- Exclude filter makes sense only when jmespath traverses a verbose json object.
65
- In case of list of dicts - textFSM case - exclude filter is not needed.
66
- See 'sw_upgrade' tests vs 'raw_novalue_exclude'.
67
- """
68
- if exclude and isinstance (output , Dict ):
69
- if not isinstance (exclude , list ):
70
- raise ValueError (f"Exclude list must be defined as a list. You have { type (exclude )} " )
71
- # exclude unwanted elements
72
- exclude_filter (output , exclude )
73
-
74
- assert_filter_definition ()
59
+ if exclude and isinstance (output , Dict ):
60
+ if not isinstance (exclude , list ):
61
+ raise ValueError (f"Exclude list must be defined as a list. You have { type (exclude )} " )
62
+ # exclude unwanted elements
63
+ exclude_filter (output , exclude )
75
64
76
65
if not path :
77
66
warnings .warn ("JMSPath cannot be empty string or type 'None'. Path argument reverted to default value '*'" )
@@ -145,7 +134,7 @@ def validate(**kwargs) -> None:
145
134
146
135
@staticmethod
147
136
def result (evaluation_result ) -> Tuple [Dict , bool ]:
148
- """Result method implementation. Will return diff data and bool for check failing result."""
137
+ """Result method implementation. Will return diff data and bool for checking failed result."""
149
138
return evaluation_result , not evaluation_result
150
139
151
140
@@ -350,3 +339,11 @@ def evaluate(self, value_to_compare: Any, params: Any) -> Tuple[Dict, bool]:
350
339
reference_data = params
351
340
evaluation_result = operator_evaluator (reference_data ["params" ], value_to_compare )
352
341
return self .result (evaluation_result )
342
+
343
+ def result (self , evaluation_result ):
344
+ """
345
+ Operator result method overwrite.
346
+
347
+ This is required as Opertor return its own boolean within result.
348
+ """
349
+ return evaluation_result [0 ], not evaluation_result [1 ]
0 commit comments