

def testUpdateAverageRatingBatch(self):
    'Test batch mode avg ratings updating.'
    models.Category.buildAllCategories()
    product = docs.Product.buildProduct(PRODUCT_PARAMS)
    config.BATCH_RATINGS_UPDATE = True
    review = models.Review(product_key=product.key, username='bob', rating=5, comment='comment')
    review.put()
    utils.updateAverageRating(review.key)
    taskq = self.testbed.get_stub(testbed.TASKQUEUE_SERVICE_NAME)
    tasks = taskq.GetTasks('default')
    taskq.FlushQueue('default')
    self.assertEqual(len(res), 0)
    product = models.Product.get_by_id(product.pid)
    sq = search.Query(query_string='ar:5.0')
    res = docs.Product.getIndex().search(sq)
    self.assertEqual(res.number_found, 0)

dataset/ETHPy150Open GoogleCloudPlatform/appengine-search-python-java/product_search_python/tests/test_search.py FTSTestCase.testUpdateAverageRatingBatch/VarMisuse@112/166 `tasks`->`res`