def test_2(self):
     r = encode('aabbccdd')
     self.assertEqual(r.letter_encodings, {
         'a': '00',
         'c': '01',
         'b': '10',
         'd': '11'
     })
     self.assertEqual(r.result_list,
                      ['00', '00', '10', '10', '01', '01', '11', '11'])
#! /usr/bin/python

# "python huffman_encoding_test.py" to run on lorem_ipsum

import huffman_encoding

input_string = open("lorem_ipsum.txt", "r").read()
symbol_to_weight = huffman_encoding.count_symbols(input_string)
encoding = huffman_encoding.encode(symbol_to_weight)
huffman_encoding.print_encoding(encoding, symbol_to_weight)
 def test_1(self):
     r = encode('aaabc')
     self.assertEqual(r.letter_encodings, {'a': '1', 'c': '00', 'b': '01'})
     self.assertEqual(r.result_list, ['1', '1', '1', '01', '00'])
 def test_2(self):
     r = encode('aabbccdd')
     self.assertEqual(r.letter_encodings, {'a': '00', 'c': '01', 'b': '10', 'd': '11'})
     self.assertEqual(r.result_list, ['00', '00', '10', '10', '01', '01', '11', '11'])
 def test_1(self):
     r = encode('aaabc')
     self.assertEqual(r.letter_encodings, {'a': '1', 'c': '00', 'b': '01'})
     self.assertEqual(r.result_list, ['1', '1', '1', '01', '00'])