-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
According to the documentation:
It’s not possible to refer to two different resources, from the same resource group, in one resource expression.
Consider this test:
def test_evaluate_same_object(self):
resource_map = {
'a': [Resource({'foo': 1, 'baz': 'b'}), Resource({'foo': 2, 'baz': 'a'})],
}
expr = ResourceExpression("a.foo == 1 and a.baz != 'b'")
self.assertFalse(expr.evaluate(
resource_map['a'],
resource_map=resource_map
))And it failing:
FAIL: test_evaluate_same_object (plainbox.impl.test_resource.ResourceExpressionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/michal/dev/canonical/checkbox/checkbox-ng/plainbox/impl/test_resource.py", line 426, in test_evaluate_same_object
self.assertFalse(expr.evaluate(
AssertionError: True is not false
There is not a single resource whose foo is 1, and baz is not b. But the expression succeeds. Wrapping the first expression in parentheses makes it work as intended.
To Reproduce
Run the above test.
Environment
N/A
Relevant log output
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working