def test_apply(self): ob = ObjectsBackend() class Foo(object): a = 1 def __eq__(self, other): return isinstance(other, Foo) and self.a == other.a query = Query([EqualsCondition('a', 1)]) assert list(ob.apply(query, [Foo()])) == [Foo()] assert list(query.apply([Foo()])) == [Foo()]