Example #1
0
    def test_import_class_empty_string(self):
        with self.assertRaises(IncorrectImportPath) as cm:
            klass = import_class('')

        self.assertTrue('Invalid Python' in str(cm.exception))
Example #2
0
    def test_import_class_invalid_class(self):
        with self.assertRaises(IncorrectImportPath) as cm:
            klass = import_class('kotocore.session.NopeSession')

        self.assertTrue('could not find' in str(cm.exception))
Example #3
0
 def test_import_class(self):
     klass = import_class('kotocore.session.Session')
     self.assertEqual(klass, Session)
Example #4
0
    def test_import_class_invalid_path(self):
        with self.assertRaises(IncorrectImportPath) as cm:
            klass = import_class('kotocore.nosuchmodule.Nope')

        self.assertTrue('Could not import' in str(cm.exception))