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)
Пример #2
0
 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)
Пример #4
0
 def setUp(self):
   FlushFunction.reset()
   self.max_entity_count = 9
   self.list = context._ItemList(
       self.max_entity_count,
       FlushFunction().flush_function)