| Total Complexity | 2 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | import unittest |
||
| 6 | class HuffmanCompressionUnitTest(unittest.TestCase): |
||
| 7 | |||
| 8 | def test_huffman_binary(self): |
||
| 9 | huffman = HuffmanCompressor() |
||
| 10 | text = 'Hello World' |
||
| 11 | bit_stream = huffman.compress_to_binary(text) |
||
| 12 | self.assertFalse(bit_stream.is_empty()) |
||
| 13 | print(bit_stream.size()) |
||
| 14 | decompressed = huffman.decompress_from_binary(bit_stream) |
||
| 15 | print(decompressed) |
||
| 16 | self.assertEqual(text, decompressed) |
||
| 17 | |||
| 18 | def text_huffman_string(self): |
||
| 19 | huffman = HuffmanCompressor() |
||
| 20 | text = 'Hello World' |
||
| 21 | |||
| 25 |