|
21 | 21 |
|
22 | 22 | import qcheck
|
23 | 23 | from test_connection import get_connection
|
| 24 | +import version |
24 | 25 | from pymongo.objectid import ObjectId
|
25 | 26 | from pymongo.code import Code
|
26 | 27 | from pymongo.binary import Binary
|
@@ -582,29 +583,29 @@ def test_group_with_scope(self):
|
582 | 583 | self.assertEqual(2, db.test.group([], {}, {"count": 0},
|
583 | 584 | Code(reduce_function,
|
584 | 585 | {"inc_value": 1}))[0]['count'])
|
585 |
| - |
586 |
| - |
587 |
| - self.assertEqual(2, db.test.group([], {}, {"count": 0}, |
588 |
| - Code(reduce_function, |
589 |
| - {"inc_value": 1}), |
590 |
| - command=True)[0]['count']) |
591 |
| - |
592 | 586 | self.assertEqual(4, db.test.group([], {}, {"count": 0},
|
593 | 587 | Code(reduce_function,
|
594 | 588 | {"inc_value": 2}))[0]['count'])
|
595 |
| - self.assertEqual(4, db.test.group([], {}, {"count": 0}, |
596 |
| - Code(reduce_function, |
597 |
| - {"inc_value": 2}), |
598 |
| - command=True)[0]['count']) |
599 | 589 |
|
600 | 590 | self.assertEqual(1, db.test.group([], {}, {"count": 0},
|
601 | 591 | Code(reduce_function,
|
602 | 592 | {"inc_value": 0.5}))[0]['count'])
|
603 |
| - self.assertEqual(1, db.test.group([], {}, {"count": 0}, |
604 |
| - Code(reduce_function, |
605 |
| - {"inc_value": 0.5}), |
606 |
| - command=True)[0]['count']) |
607 | 593 |
|
| 594 | + if version.at_least(db.connection(), (1, 1)): |
| 595 | + self.assertEqual(2, db.test.group([], {}, {"count": 0}, |
| 596 | + Code(reduce_function, |
| 597 | + {"inc_value": 1}), |
| 598 | + command=True)[0]['count']) |
| 599 | + |
| 600 | + self.assertEqual(4, db.test.group([], {}, {"count": 0}, |
| 601 | + Code(reduce_function, |
| 602 | + {"inc_value": 2}), |
| 603 | + command=True)[0]['count']) |
| 604 | + |
| 605 | + self.assertEqual(1, db.test.group([], {}, {"count": 0}, |
| 606 | + Code(reduce_function, |
| 607 | + {"inc_value": 0.5}), |
| 608 | + command=True)[0]['count']) |
608 | 609 |
|
609 | 610 | def test_large_limit(self):
|
610 | 611 | db = self.db
|
|
0 commit comments