def test(): h = Heap() h.data_from_string('SORTEXAMPLE') print 'initial', h s = HeapSort() sorted_heap = s.sort(h) assert unicode(sorted_heap) == 'A E E L M O P R S T X', h print 'sort ok'