fix the $max operator

This commit is contained in:
Stefan Wojcik 2017-02-26 02:24:48 -05:00
parent a94ec06275
commit 7850e47bf7
2 changed files with 6 additions and 8 deletions

View File

@ -155,9 +155,7 @@ class GeoQueriesTest(MongoDBTestCase):
"""Ensure that spherical geospatial queries are working
"""
# Needs MongoDB > 2.6.4 https://jira.mongodb.org/browse/SERVER-14039
connection = get_connection()
info = connection.test.command('buildInfo')
mongodb_version = tuple([int(i) for i in info['version'].split('.')])
mongodb_version = get_mongodb_version()
if mongodb_version < (2, 6, 4):
raise SkipTest("Need MongoDB version 2.6.4+")
@ -314,7 +312,7 @@ class GeoQueriesTest(MongoDBTestCase):
self.assertEqual(events.count(), 0)
# $minDistance was only added in MongoDB v2.6, skip for older versions
mongodb_ver = get_mongodb_ver()
mongodb_ver = get_mongodb_version()
if mongodb_ver[0] == 2 and mongodb_ver[1] < 6:
raise SkipTest('Need MongoDB v2.6+')

View File

@ -584,10 +584,10 @@ class QuerySetTest(unittest.TestCase):
Scores.objects(id=scores.id).update(min__low_score=250)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 150)
Scores.objects(id=scores.id).update(max__high_score=250)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 250)
Scores.objects(id=scores.id).update(max__high_score=100)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 250)
Scores.objects(id=scores.id).update(max__high_score=1000)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 1000)
Scores.objects(id=scores.id).update(max__high_score=500)
self.assertEqual(Scores.objects.get(id=scores.id).low_score, 1000)
def test_updates_can_have_match_operators(self):