Beispiel #1
0
    def test_decorator_attrs(self):
        def fxn(self, module):
            pass

        wrapped = util.module_for_loader(fxn)
        self.assertEqual(wrapped.__name__, fxn.__name__)
        self.assertEqual(wrapped.__qualname__, fxn.__qualname__)
Beispiel #2
0
 def raise_exception(self, name):
     def to_wrap(self, module):
         raise ImportError
     fxn = util.module_for_loader(to_wrap)
     try:
         fxn(self, name)
     except ImportError:
         pass
Beispiel #3
0
 def return_module(self, name):
     fxn = util.module_for_loader(lambda self, module: module)
     return fxn(self, name)
Beispiel #4
0
 def test_decorator_attrs(self):
     def fxn(self, module): pass
     wrapped = util.module_for_loader(fxn)
     self.assertEqual(wrapped.__name__, fxn.__name__)
     self.assertEqual(wrapped.__qualname__, fxn.__qualname__)
Beispiel #5
0
 def module_for_loader(func):
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', PendingDeprecationWarning)
         return util.module_for_loader(func)
Beispiel #6
0
 def test_warning(self):
     # Should raise a PendingDeprecationWarning when used.
     with warnings.catch_warnings():
         warnings.simplefilter('error', PendingDeprecationWarning)
         with self.assertRaises(PendingDeprecationWarning):
             func = util.module_for_loader(lambda x: x)
Beispiel #7
0
 def module_for_loader(func):
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', PendingDeprecationWarning)
         return util.module_for_loader(func)
Beispiel #8
0
 def test_warning(self):
     # Should raise a PendingDeprecationWarning when used.
     with warnings.catch_warnings():
         warnings.simplefilter('error', PendingDeprecationWarning)
         with self.assertRaises(PendingDeprecationWarning):
             func = util.module_for_loader(lambda x: x)