Ejemplo n.º 1
0
 def test_run3(self):
     """test method for run with no text
     """
     target = "hogehoge"
     text = ""
     with self.assertRaises(search.AiMySearch.TargetTextError):
         search.AiMySearch(target, text, 0, 0.8)
Ejemplo n.º 2
0
 def test_run5(self):
     """test method for run
     """
     target = "hoge"
     text = "aaaaohohaaaa"
     actual = search.AiMySearch(target, text, 0, 0.8).run()
     expected = [{'index': 4, 'length': 4, 'text': 'ohoh'}]
     self.assertEqual(expected, actual)
Ejemplo n.º 3
0
 def test_run2(self):
     """test method for run with high match rate
     """
     target = "hogehoge"
     text = "hogehogfugafugapiyopihogehugepiyo"
     actual = search.AiMySearch(target, text, 0, 0.8).run()
     expected = [{'index': 0, 'length': 8, 'text': 'hogehogf'},
                 {'index': 21, 'length': 8, 'text': 'hogehuge'}]
     self.assertEqual(expected, actual)
Ejemplo n.º 4
0
 def test_run(self):
     """test method for run
     """
     target = "hogehoge"
     text = "hogehogfugafugapiyopihogehugepiyo"
     actual = search.AiMySearch(target, text).run()
     expected = [{'index': 0, 'length': 11, 'text': 'hogehogfuga'},
                 {'index': 17, 'length': 14, 'text': 'yopihogehugepi'}]
     self.assertEqual(expected, actual)