Update tests for bytes/bytearray for block/Py3
@@ -215,10 +215,20 @@ if sys.version_info < (2, 7):
del TestLZ4BlockModern
class TestLZ4BlockPy3ByteArray(unittest.TestCase):
- def test_random(self):
+ def test_random_bytearray(self):
DATA = bytearray(os.urandom(128 * 1024)) # Read 128kb
- self.assertEqual(DATA, lz4.block.decompress(lz4.block.compress(DATA)))
-
+ compressed = lz4.block.compress(DATA, return_bytearray=True)
+ self.assertEqual(type(compressed), bytearray)
+ decompressed = lz4.block.decompress(compressed, return_bytearray=True)
+ self.assertEqual(type(decompressed), bytearray)
+ self.assertEqual(decompressed, DATA)
+ def test_random_bytes(self):
+ DATA = bytearray(os.urandom(128 * 1024)) # Read 128kb
+ compressed = lz4.block.compress(DATA)
+ self.assertEqual(type(compressed), bytes)
+ decompressed = lz4.block.decompress(compressed)
+ self.assertEqual(type(decompressed), bytes)
+ self.assertEqual(decompressed, DATA)
if sys.version_info < (3, 3):
# Poor-man unittest.TestCase.skip for Python < 3.3
