Exemple #1
0
    def __init__(self, splitter_config):
        Activatable.__init__(self)

        assert (splitter_config is not None)
        assert (isinstance(splitter_config, BotSentenceSplitterConfiguration))

        self._configuration = splitter_config
    def test_invalid_state(self):
        activatable = Activatable()
        self.assertIsNotNone(activatable)
        self.assertEquals(Activatable.ON, activatable.active)

        activatable.active = "OTHER"

        self.assertEquals(Activatable.ON, activatable.active)
    def __init__(self, splitter_config):
        Activatable.__init__(self)

        assert (splitter_config is not None)
        assert (isinstance(splitter_config, BotSentenceSplitterConfiguration))

        self._configuration = splitter_config
        self._punctuations = re.compile(SentenceSplitter.ALL_PUNCTUATION)
    def test_init(self):
        activatable = Activatable()
        self.assertIsNotNone(activatable)
        self.assertEquals(Activatable.ON, activatable.active)
        self.assertTrue(activatable.is_active())

        activatable = Activatable(Activatable.ON)
        self.assertIsNotNone(activatable)
        self.assertEquals(Activatable.ON, activatable.active)
        self.assertTrue(activatable.is_active())

        activatable = Activatable(Activatable.OFF)
        self.assertIsNotNone(activatable)
        self.assertEquals(Activatable.OFF, activatable.active)
        self.assertFalse(activatable.is_active())
    def test_on_off(self):
        activatable = Activatable()
        self.assertIsNotNone(activatable)
        self.assertEquals(Activatable.ON, activatable.active)

        activatable.active = Activatable.OFF
        self.assertEquals(Activatable.OFF, activatable.active)
        self.assertFalse(activatable.is_active())

        activatable.active = Activatable.ON
        self.assertEquals(Activatable.ON, activatable.active)
        self.assertTrue(activatable.is_active())
Exemple #6
0
 def __init__(self, spelling_config=None):
     Activatable.__init__(self)
     self.spelling_config = spelling_config