def test_next_limit(self): q = Queue() upload_size = 50 consumer = Consumer(q, '', upload_size) for i in range(10000): q.put(i) next = consumer.next() self.assertEqual(next, list(range(upload_size)))
def test_dropping_oversize_msg(self): q = Queue() consumer = Consumer(q, '') oversize_msg = {'m': 'x' * MAX_MSG_SIZE} q.put(oversize_msg) next = consumer.next() self.assertEqual(next, []) self.assertTrue(q.empty())
def test_next_limit(self): q = Queue() flush_at = 50 consumer = Consumer(q, '', flush_at) for i in range(10000): q.put(i) next = consumer.next() self.assertEqual(next, list(range(flush_at)))
def test_next_limit(self): q = Queue() upload_size = 50 consumer = Consumer(q, '', upload_size) for i in range(10000): q.put(i) next = consumer.next() self.assertEqual(next, list(range(upload_size)))
def test_dropping_oversize_msg(self): q = Queue() consumer = Consumer(q, '') oversize_msg = {'m': 'x' * MAX_MSG_SIZE} q.put(oversize_msg) next = consumer.next() self.assertEqual(next, []) self.assertTrue(q.empty())
def test_next(self): q = Queue() consumer = Consumer(q, '') q.put(1) next = consumer.next() self.assertEqual(next, [1])
def test_next(self): q = Queue() consumer = Consumer(q, '') q.put(1) next = consumer.next() self.assertEqual(next, [1])