def test_called_from_function(self):
import warnings
from guillotina.component._declaration import adapts
from zope.interface import Interface
class IFoo(Interface):
pass
globs = {'adapts': adapts, 'IFoo': IFoo}
locs = {}
CODE = "\n".join([
'def foo():',
' adapts(IFoo)'
])
if self._run_generated_code(CODE, globs, locs, False):
foo = locs['foo']
with warnings.catch_warnings(record=True) as log:
warnings.resetwarnings()
self.assertRaises(TypeError, foo)
self.assertEqual(len(log), 0) # no longer warn
评论列表
文章目录