def test_combine_answers(self): config = BotSentenceJoinerConfiguration() self.assertIsNotNone(config) config._classname = 'programy.dialog.joiner.joiner_jp.SentenceJoiner' config._join_chars = '.?!。?!' config._terminator = '。' joiner = SentenceJoiner.initiate_sentence_joiner(config) self.assertIsNotNone(joiner) self.assertEquals("", joiner.combine_answers([""], False)) self.assertEquals("this is a pen。", joiner.combine_answers(["this is a pen"], False)) self.assertEquals("こんにちは。", joiner.combine_answers(["こんにちは"], False)) self.assertEquals("this is a pen.", joiner.combine_answers(["this is a pen."], False)) self.assertEquals("こんにちは。", joiner.combine_answers(["こんにちは。"], False)) self.assertEquals("is this a pen?", joiner.combine_answers(["is this a pen?"], False)) self.assertEquals("こんにちは?", joiner.combine_answers(["こんにちは?"], False)) self.assertEquals("is this a pen!", joiner.combine_answers(["is this a pen!"], False)) self.assertEquals("こんにちは!", joiner.combine_answers(["こんにちは!"], False))
def test_initiate_class_none(self): config = BotSentenceJoinerConfiguration() self.assertIsNotNone(config) config._classname = None config._join_chars = '.?!。?!' config._terminator = '。' joiner = SentenceJoiner.initiate_sentence_joiner(config) self.assertIsNone(joiner)
def test_initiate_joiner(self): config = BotSentenceJoinerConfiguration() self.assertIsNotNone(config) config._classname = 'programy.dialog.joiner.joiner_jp.SentenceJoiner' config._join_chars = '.?!。?!' config._terminator = '。' joiner = SentenceJoiner.initiate_sentence_joiner(config) self.assertIsNotNone(joiner) self.assertIsInstance(joiner, SentenceJoiner)