Ejemplo n.º 1
0
    def test_processing(self):
        collection = ProcessorCollection()
        collection.add_processor(ToUpperPreProcessor())
        collection.add_processor(ToUpperPreProcessor())

        result = collection.process(None, "hello")
        self.assertIsNotNone(result)
        self.assertEquals("HELLO", result)
Ejemplo n.º 2
0
    def assert_upload_from_file(self, store):

        store.upload_from_file(os.path.dirname(__file__) + os.sep + "data" + os.sep + "processors" + os.sep + "preprocessors.conf")

        collection = ProcessorCollection()
        store.load(collection)

        self.assertEqual(2, len(collection.processors))
Ejemplo n.º 3
0
    def test_process_line_with_exception(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileProcessorsStore(engine)

        collection = ProcessorCollection()
        count = store._process_line("XXXXXX", collection, 0)
        self.assertEquals(0, count)
Ejemplo n.º 4
0
    def test_load_file_contents(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileProcessorsStore(engine)

        collection = ProcessorCollection()
        count = store._load_file_contents(collection, os.path.dirname(__file__) + os.sep + "data" + os.sep + "processors" + os.sep + "preprocessors.conf")
        self.assertEquals(2, count)
Ejemplo n.º 5
0
    def test_process_line(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileProcessorsStore(engine)
        collection = ProcessorCollection()

        self.assertEquals(0, store._process_line("", collection, 0))
        self.assertEquals(0, store._process_line("#programy.processors.post.denormalize.DenormalizePostProcessor", collection, 0))
        self.assertEquals(1, store._process_line("programy.processors.post.denormalize.DenormalizePostProcessor", collection, 0))
Ejemplo n.º 6
0
    def test_load_postprocessors(self):
        config = FileStorageConfiguration()
        config._postquestionprocessors_storage = FileStoreConfiguration(file=os.path.dirname(__file__) + os.sep + "data" + os.sep + "processors" + os.sep + "postquestionprocessors.conf", fileformat="text", encoding="utf-8", delete_on_start=False)
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FilePostQuestionProcessorsStore(engine)

        collection = ProcessorCollection()
        store.load(collection)

        self.assertEqual(0, len(collection.processors))
Ejemplo n.º 7
0
    def test_processing_no_processors(self):
        collection = ProcessorCollection()

        result = collection.process(None, "hello")
        self.assertIsNotNone(result)
        self.assertEquals("hello", result)