Example #1
0
    def test_load_category(self):
        client = CategoryTestClient()
        client_context = client.create_client_context("test1")
        parser = client_context.brain.aiml_parser

        store = CategoryReadOnlyStore()
        store._load_category("group1", "HELLO", "*", "*", "Test Hello!",
                             parser)

        match = parser.match_sentence(client_context,
                                      Sentence(client_context, "HELLO"), "*",
                                      "*")
        self.assertIsNotNone(match)
Example #2
0
    def test_load_category_parser_exception2(self):
        client = CategoryTestClient()
        client_context = client.create_client_context("test1")
        parser = client_context.brain.aiml_parser
        parser.brain.configuration.debugfiles._save_errors = True
        parser.brain.configuration.debugfiles._save_duplicates = True
        parser.create_debug_storage()

        store = CategoryReadOnlyStore()
        self.assertEqual(0, len(parser._duplicates))
        store._load_category("group1", "HELLO", "*", "*", "Test Hello!",
                             parser)

        match = parser.match_sentence(client_context,
                                      Sentence(client_context, "HELLO"), "*",
                                      "*")
        self.assertIsNone(match)