Example #1
0
    def test_function(self):
        path = 'test_app.model.test_initializer'
        result = tethys_function_extractor.TethysFunctionExtractor(
            path=path).function

        # Check Result
        self.assertIsInstance(result, types.FunctionType)
Example #2
0
    def test_init_func(self):
        result = tethys_function_extractor.TethysFunctionExtractor(
            path=test_func)

        # Check Result
        self.assertIs(test_func, result.function)
        self.assertTrue(result.valid)
Example #3
0
    def test_valid(self):
        path = 'test_app.model.test_initializer'
        result = tethys_function_extractor.TethysFunctionExtractor(
            path=path).valid

        # Check Result
        self.assertTrue(result)
Example #4
0
    def test_init(self):
        path = 'tethysapp-test_app.tethysapp.test_app.controller.home'
        result = tethys_function_extractor.TethysFunctionExtractor(path=path)

        # Check Result
        self.assertEqual(path, result.path)
        self.assertEqual('tethysapp', result.prefix)
Example #5
0
    def test_function_error(self):
        path = 'test_app1.foo'
        app = tethys_function_extractor.TethysFunctionExtractor(path=path,
                                                                throw=True)

        def test_function_import():
            return app.function

        self.assertRaises(ImportError, test_function_import)