hypatia icon indicating copy to clipboard operation
hypatia copied to clipboard

AttributeError: query has no index making query.execute fail in certain boolean combinations

Open reebalazs opened this issue 11 years ago • 1 comments

The BoolOp does not have an index property, but execute checks that for the first index. So If the first query itself is composed by another boolean, it will fail.

I don't know if the index is really necessary here, I just made the method to a classmethod so it can be called without requiring an index attibute.

I demonstrate some tests, if the code part is reverted then test_execute_first will fail, while test_execute_second passes.

Going more down in testing execute requires the change of the mocking at existing tests.

ERROR: test_execute_first (hypatia.query.tests.TestExecute)

Traceback (most recent call last): File "/Users/ree/work/substanced/hypatia/00/hypatia/query/tests.py", line 760, in test_execute_first a.execute() File "/Users/ree/work/substanced/hypatia/00/hypatia/query/init.py", line 409, in execute index = self.queries[0].index AttributeError: 'Or' object has no attribute 'index'

reebalazs avatar Sep 08 '13 09:09 reebalazs

fix-4-attributeerror-index contains the test + proposed fix

reebalazs avatar Sep 08 '13 09:09 reebalazs

Closed via https://github.com/Pylons/hypatia/commit/62adf211e9e26183da467771ed6a75ca1f69ac77

tseaver avatar May 15 '24 16:05 tseaver