def test_multiple_classes_found(self): """An error should be raised if multiple classes are found.""" module = import_module('rapidsms.utils.test_modules') self.assertRaises(AttributeError, get_class, module, ParentA)
def test_no_classes_found(self): """An error should be raised if no classes are found.""" from rapidsms.backends.base import BackendBase module = import_module('rapidsms.utils.test_modules') self.assertRaises(AttributeError, get_class, module, BackendBase)
def test_get_class(self): """get_class() should return the proper class.""" module = import_module('rapidsms.utils.test_modules') class_ = get_class(module, ParentB) self.assertEqual(ParentB, class_)