Exemplo n.º 1
0
 def test_pipeline(self):
     plugins = [
         call_symbol('octavious.tests', 'Plugin1'),
         call_symbol('octavious.tests', 'Plugin2'),
         call_symbol('octavious.tests', 'Plugin3'),
     ]
     pipeline = Pipeline(plugins)
     output = pipeline.pre_process({})
     output = pipeline.post_process({}, output)
     self.assertTrue(output['pre_processed_1'])
     self.assertTrue(output['post_processed_1'])
     self.assertTrue(output['post_processed_2'])
     self.assertTrue(output['post_processed_3'])
     with self.assertRaises(KeyError):
         self.assertTrue(output['pre_processed_2'])
     with self.assertRaises(KeyError):
         self.assertTrue(output['pre_processed_3'])
Exemplo n.º 2
0
 def test_call_symbol(self):
     plugin = call_symbol('octavious.tests', 'Plugin1')
     self.assertEqual(plugin.__class__.__name__, 'Plugin1')
     self.assertTrue(isinstance(plugin, Plugin1))
     with self.assertRaises(ImportError):
         call_symbol('octavious.tests', 'NotAvailableSymbol')