Merge remote-tracking branch 'origin/pr/333' into 333

This commit is contained in:
Ross Lawley
2013-06-04 10:22:54 +00:00
2 changed files with 10 additions and 7 deletions

View File

@@ -69,10 +69,8 @@ class QTest(unittest.TestCase):
y = StringField()
# Check than an error is raised when conflicting queries are anded
def invalid_combination():
query = Q(x__lt=7) & Q(x__lt=3)
query.to_query(TestDoc)
self.assertRaises(InvalidQueryError, invalid_combination)
query = (Q(x__lt=7) & Q(x__lt=3)).to_query(TestDoc)
self.assertEqual(query, {'$and': [ {'x': {'$lt': 7}}, {'x': {'$lt': 3}} ]})
# Check normal cases work without an error
query = Q(x__lt=7) & Q(x__gt=3)