def test_with_large_strings(self): test_sizes = [1000, 10000, 100000] for size in test_sizes: contents = random_string(size) decoded = heatshrink.decode(heatshrink.encode(contents)) # Check whole file, but don't use assertEqual as it will # print all the data if decoded != contents: msg = ('Decoded and original file contents ' 'do not match for size: {}') self.fail(msg.format(size))
def test_with_a_paragraph(self): encoded = heatshrink.encode(TEXT) self.assertEqual(heatshrink.decode(encoded), TEXT)
def test_round_trip(self): encoded = heatshrink.encode(b'a string') self.assertEqual(heatshrink.decode(encoded), 'a string')
def test_decode_with_lookahead_sz2(self): decoded = heatshrink.decode('\xb0\xd8\xacvK(', lookahead_sz2=3) self.assertEqual(decoded, 'abcde')
def test_decode_with_window_sz2(self): decoded = heatshrink.decode(b'\xb0\xd8\xacvK(', window_sz2=11) self.assertEqual(decoded, 'abcde')
def test_returns_string(self): self.assertIsInstance(heatshrink.decode('abcde'), str)