def testMultiQuery(self): q1 = query.Query(kind='Foo').filter(Foo.tags == 'jill').order(Foo.name) q2 = query.Query(kind='Foo').filter(Foo.tags == 'joe').order(Foo.name) qq = query._MultiQuery([q1, q2], query._ordering_to_order(('name', query._ASC))) res = list(qq) self.assertEqual(res, [self.jill, self.joe])
def testMultiQueryWithAndWithoutAncestor(self): class Benjamin(model.Model): name = model.StringProperty() ben = Benjamin(name='ben', parent=self.moe.key) ben.put() benji = Benjamin(name='benji') benji.put() bq = Benjamin.query() baq = Benjamin.query(ancestor=self.moe.key) mq = query._MultiQuery([bq, baq]) res = list(mq) self.assertEqual(res, [benji, ben])