def test_with_real_count(self):
     counter = WordSegmentCounter()
     generator = RerankPrunedChoicesGenerator(max_len = 4,
                     trellis_element_class = ElementImpl,
                     insep_map_class = FakeInsepMap,
                     word_segment_counter = counter,
                     choice_cmp_func = default_choice_cmp_func)
     trellis = TrellisImpl(generate_unicode_text(txt_len = 10))
     trellis.add_element(
         ElementImpl(s = 2, 
                     e = 4, 
                     element_type = ElementType.WORD,
                     value = None))
     trellis.add_element(
         ElementImpl(s = 4, 
                     e = 6, 
                     element_type = ElementType.WORD,
                     value = None))
     
     answer = Answer(trellis = trellis,
                     boundaries = [])
     choices = generator.get_choices(answer, 2)
     assert len(choices) == 4
     assert choices[0].get_e() == 6
     assert choices[1].get_e() == 4
     assert choices[2].get_e() == 3
     assert choices[3].get_e() == 5
 def test_with_fake_counter(self):
     fake_word_segment_counter = FakeWordSegmentCounter()
     generator = RerankPrunedChoicesGenerator(max_len = 4, 
                    trellis_element_class = ElementImpl,
                    insep_map_class = FakeInsepMap,
                    word_segment_counter = FakeWordSegmentCounter(),
                    choice_cmp_func = default_choice_cmp_func)
     trellis = TrellisImpl(generate_unicode_text(txt_len = 10))
     answer = Answer(trellis = trellis,
                     boundaries = [])
     choices = generator.get_choices(answer, 2)
     assert len(choices) == 4
     assert choices[0].get_e() == 6
     assert choices[1].get_e() == 4
     assert choices[2].get_e() == 3
     assert choices[3].get_e() == 5