示例#1
0
    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))
示例#2
0
 def test_with_a_paragraph(self):
     encoded = heatshrink.encode(TEXT)
     self.assertEqual(heatshrink.decode(encoded), TEXT)
示例#3
0
 def test_round_trip(self):
     encoded = heatshrink.encode(b'a string')
     self.assertEqual(heatshrink.decode(encoded), 'a string')
示例#4
0
 def test_decode_with_lookahead_sz2(self):
     decoded = heatshrink.decode('\xb0\xd8\xacvK(', lookahead_sz2=3)
     self.assertEqual(decoded, 'abcde')
示例#5
0
 def test_decode_with_window_sz2(self):
     decoded = heatshrink.decode(b'\xb0\xd8\xacvK(', window_sz2=11)
     self.assertEqual(decoded, 'abcde')
示例#6
0
 def test_returns_string(self):
     self.assertIsInstance(heatshrink.decode('abcde'), str)