コード例 #1
0
ファイル: test_core.py プロジェクト: nyov/pyheatshrink
    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
ファイル: test_core.py プロジェクト: nyov/pyheatshrink
 def test_with_a_paragraph(self):
     encoded = heatshrink.encode(TEXT)
     self.assertEqual(heatshrink.decode(encoded), TEXT)
コード例 #3
0
ファイル: test_core.py プロジェクト: nyov/pyheatshrink
 def test_round_trip(self):
     encoded = heatshrink.encode(b'a string')
     self.assertEqual(heatshrink.decode(encoded), 'a string')
コード例 #4
0
ファイル: test_core.py プロジェクト: nyov/pyheatshrink
 def test_decode_with_lookahead_sz2(self):
     decoded = heatshrink.decode('\xb0\xd8\xacvK(', lookahead_sz2=3)
     self.assertEqual(decoded, 'abcde')
コード例 #5
0
ファイル: test_core.py プロジェクト: nyov/pyheatshrink
 def test_decode_with_window_sz2(self):
     decoded = heatshrink.decode(b'\xb0\xd8\xacvK(', window_sz2=11)
     self.assertEqual(decoded, 'abcde')
コード例 #6
0
ファイル: test_core.py プロジェクト: nyov/pyheatshrink
 def test_returns_string(self):
     self.assertIsInstance(heatshrink.decode('abcde'), str)