/usr/lib/python2.7/dist-packages/pyramid/tests/test_config/test_rendering.py is in python-pyramid 1.4.5+dfsg-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import unittest
import warnings
from pyramid.tests.test_config import dummyfactory
class TestRenderingConfiguratorMixin(unittest.TestCase):
def _makeOne(self, *arg, **kw):
from pyramid.config import Configurator
config = Configurator(*arg, **kw)
return config
def test_set_renderer_globals_factory(self):
from pyramid.interfaces import IRendererGlobalsFactory
config = self._makeOne(autocommit=True)
factory = object()
with warnings.catch_warnings():
warnings.filterwarnings('ignore')
config.set_renderer_globals_factory(factory)
self.assertEqual(
config.registry.getUtility(IRendererGlobalsFactory),
factory)
def test_set_renderer_globals_factory_dottedname(self):
from pyramid.interfaces import IRendererGlobalsFactory
config = self._makeOne(autocommit=True)
with warnings.catch_warnings():
warnings.filterwarnings('ignore')
config.set_renderer_globals_factory(
'pyramid.tests.test_config.dummyfactory')
self.assertEqual(
config.registry.getUtility(IRendererGlobalsFactory),
dummyfactory)
def test_add_renderer(self):
from pyramid.interfaces import IRendererFactory
config = self._makeOne(autocommit=True)
renderer = object()
config.add_renderer('name', renderer)
self.assertEqual(config.registry.getUtility(IRendererFactory, 'name'),
renderer)
def test_add_renderer_dottedname_factory(self):
from pyramid.interfaces import IRendererFactory
config = self._makeOne(autocommit=True)
import pyramid.tests.test_config
config.add_renderer('name', 'pyramid.tests.test_config')
self.assertEqual(config.registry.getUtility(IRendererFactory, 'name'),
pyramid.tests.test_config)
|