def test_complex_query_building_with_dict(self): from xotl.ql.expressions import min_, max_ d = { parent.age: (min_(child.age), max_(child.age)) for parent in this('parent') if (parent.age > 32) & parent.children for child in parent.children if child.age < 5 } parts = self.bubble.parts ok = lambda which: self.assertEqual(str(which), str(parts.pop(-1))) parent = this('parent') child = parent.children ok(parent.age) # The key of the dict is the top-most expression ok(max_(child.age)) ok(min_(child.age)) ok(child.age < 5) ok((parent.age > 32) & parent.children) with self.assertRaises(IndexError): ok(None)