def testFlushWithTooLargeRequestError(self):
     self.list = context._ItemList(
         self.max_entity_count,
         FlushFunction().flush_function_too_large_error,
         repr_function=lambda item: item)
     items = [(s, 'a' * s) for s in range(10, 1, -1)]
     items_copy = list(items)
     random.seed(1)
     random.shuffle(items_copy)
     for _, i in items_copy:
         self.list.append(i)
     self.assertRaises(apiproxy_errors.RequestTooLargeError,
                       self.list.flush)
     self.assertEqual(items[:context._ItemList._LARGEST_ITEMS_TO_LOG],
                      self.list._largest)
 def testFlushWithTooLargeRequestError(self):
   self.list = context._ItemList(
       self.max_entity_count,
       FlushFunction().flush_function_too_large_error,
       repr_function=lambda item: item)
   items = [(s, 'a'*s) for s in range(10, 1, -1)]
   items_copy = list(items)
   random.seed(1)
   random.shuffle(items_copy)
   for _, i in items_copy:
     self.list.append(i)
   self.assertRaises(apiproxy_errors.RequestTooLargeError,
                     self.list.flush)
   self.assertEqual(items[:context._ItemList._LARGEST_ITEMS_TO_LOG],
                    self.list._largest)
 def setUp(self):
     FlushFunction.reset()
     self.max_entity_count = 9
     self.list = context._ItemList(self.max_entity_count,
                                   FlushFunction().flush_function)
 def setUp(self):
   FlushFunction.reset()
   self.max_entity_count = 9
   self.list = context._ItemList(
       self.max_entity_count,
       FlushFunction().flush_function)