@defer.inlineCallbacks
    def test_group(self):
        yield self.coll.insert([{'v': 2 % i} for i in range(5)], safe=True)
        reduce_ = """
        function(curr, result) {
            result.total += curr.v;
        }
        """
        keys = {'v': 1}
        initial = {"total": 0}
        cond = {'v': {"$in": [0, 1]}}
        final = """
        function(result) {
            result.five = 5;
        }
        """
        res = yield self.coll.group(keys, initial, reduce_, cond, final)
        self.assertEqual(len(res["retval"]), 2)

        keys = """
        function(doc) {
            return {"value": 5, 'v': 1};
        }
        """

        res = yield self.coll.group(keys, initial, reduce_, cond, final)
        self.assertEqual(len(res["retval"]), 1)
dataset/ETHPy150Open twisted/txmongo/tests/test_queries.py/TestMongoQueries.test_group/swapped operands of `%`