

def test__map_reduce_with_query(self):
    expected_results = [{
        '_id': 'mouse',
        'value': 1,
    }, {
        '_id': 'dog',
        'value': 2,
    }, {
        '_id': 'cat',
        'value': 2,
    }]
    result = self.db.things.map_reduce(self.map_func, self.reduce_func, 'myresults', query={
        'tags': 'dog',
    })
    self.assertTrue(isinstance(result, mongomock.Collection))
    self.assertEqual(self.name, 'myresults')
    self.assertEqual(result.count(), 3)
    for doc in result.find():
        self.assertIn(doc, expected_results)

dataset/ETHPy150Open vmalloc/mongomock/tests/test__mongomock.py CollectionMapReduceTest.test__map_reduce_with_query/VarMisuse@106/147 `result`->`self`