def test_example_1(self): q = Query() q.find = ((~(q.profile.age > 20)) & (q.username == 'test')) self.assertDictEqual(q.find, {'$and': [{'profile.age': {'$not': {'$gt': 20}}}, {'username': {'$eq': 'test'}}]})
def test_basic_find(self): q = Query() q.find = ((q.username == 'test') & ~(q.profile.gender == 1)) self.assertDictEqual(q.find, {'$and': [{'username': {'$eq': 'test'}}, {'profile.gender': {'$not': {'$eq': 1}}}]})