2021-03-03 01:20:18 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
import random
|
|
|
|
import unittest
|
|
|
|
|
2021-03-03 13:48:22 +00:00
|
|
|
from pyembroidery import *
|
2021-03-03 01:20:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestReadHus(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_fake_compression(self):
|
|
|
|
for i in range(10):
|
2021-03-05 02:31:19 +00:00
|
|
|
s = random.randint(10, 1000) # May fail if larger.
|
2021-03-03 01:20:18 +00:00
|
|
|
test_bytes = bytearray(random.getrandbits(8) for _ in range(s))
|
2021-03-03 13:48:22 +00:00
|
|
|
compressed_bytes = EmbCompress.compress(test_bytes)
|
|
|
|
uncompressed = bytearray(EmbCompress.expand(compressed_bytes, len(test_bytes)))
|
2021-03-03 01:20:18 +00:00
|
|
|
self.assertEqual(test_bytes, uncompressed)
|