'Test raw plays nicely'

def test_raw_query_and_Q_objects(self):

    class Foo(Document, ):
        name = StringField()
        a = StringField()
        b = StringField()
        c = StringField()
        meta = {'allow_inheritance': False}
    query = Foo.objects(__raw__={'$nor': [{'name': 'bar'}]})._query
    self.assertEqual(query, {'$nor': [{'name': 'bar'}]})
    q1 = {'$or': [{'a': 1}, {'b': 1}]}
    query = Foo.objects((Q(__raw__=q1) & Q(c=1)))._query
    self.assertEqual(query, {'$or': [{'a': 1}, {'b': 1}], 'c': 1})
