def test_rejects_non_integer_capacity(self): try: capacity = "not an integer" TailDrop(self.queue, capacity) self.fail("AssertionError expected!") except AssertionError as error: self.assertEqual(error.args[0], TailDrop.INVALID_CAPACITY.format(object=capacity))
def test_rejects_negative_capacity(self): try: capacity = -5 TailDrop(self.queue, capacity) self.fail("AssertionError expected!") except AssertionError as error: self.assertEqual( error.args[0], TailDrop.NEGATIVE_CAPACITY.format(capacity=capacity))
def create_tail_drop(self, environment, capacity, task_pool): return ThrottlingWrapper(environment, TailDrop(task_pool, capacity))
def setUp(self): self.capacity = 50 self.queue = MagicMock(TaskPool) self.pool_size(50) self.throttling = TailDrop(self.queue, self.capacity)