Example #1
0
    def test_string_processor(self):

        processor = StringProcessor()

        self.assertEquals(processor.max_bytes, 1024 * 25 * 40)

        output = list(processor.add_item("test"))

        self.assertEqual(len(output), 1)
        self.assertIsInstance(output[0], OutputItem)

        self.assertEqual(output[0].size, len("test"))
        self.assertEqual(output[0].n, 1)
        self.assertEqual(output[0].data, b"test")

        self.assertFalse(processor.has_items())
Example #2
0
    def test_processor_exceed_put_limit(self):
        processor = StringProcessor()

        with self.assertRaises(exceptions.ExceededPutLimit):
            list(processor.add_item(self.random_string(1024 * 1024 + 1)))