"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Cheetah/Tests/NameMapper_pure.py" between
cheetah3-3.1.0.tar.gz and cheetah3-3.2.0.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

NameMapper_pure.py  (cheetah3-3.1.0):NameMapper_pure.py  (cheetah3-3.2.0)
skipping to change at line 13 skipping to change at line 13
import sys import sys
import unittest import unittest
try: try:
from Cheetah import _namemapper # noqa from Cheetah import _namemapper # noqa
except ImportError: except ImportError:
# _namemapper hasn't been compiled so Tests/NameMapper.py # _namemapper hasn't been compiled so Tests/NameMapper.py
# tests pure-python NameMapper.py; no need to duplicate these tests. # tests pure-python NameMapper.py; no need to duplicate these tests.
pass pass
def setUpModule(): def _setNameMapperFunctions():
if 'Cheetah.NameMapper' in sys.modules:
del sys.modules['Cheetah.NameMapper']
sys.modules['Cheetah._namemapper'] = None
from Cheetah.NameMapper import NotFound, \ from Cheetah.NameMapper import NotFound, \
valueForName, valueFromSearchList, valueFromFrame, \ valueForName, valueFromSearchList, valueFromFrame, \
valueFromFrameOrSearchList valueFromFrameOrSearchList
from Cheetah.Tests import NameMapper from Cheetah.Tests import NameMapper
for func in [ for func in [
NotFound, valueForName, valueFromSearchList, NotFound, valueForName, valueFromSearchList,
valueFromFrame, valueFromFrameOrSearchList valueFromFrame, valueFromFrameOrSearchList
]: ]:
setattr(NameMapper, func.__name__, func) setattr(NameMapper, func.__name__, func)
def setUpModule():
if 'Cheetah.NameMapper' in sys.modules:
del sys.modules['Cheetah.NameMapper']
sys.modules['Cheetah._namemapper'] = None # emulate absence of the module
_setNameMapperFunctions()
def tearDownModule(): def tearDownModule():
del sys.modules['Cheetah.NameMapper'] del sys.modules['Cheetah.NameMapper']
del sys.modules['Cheetah._namemapper'] del sys.modules['Cheetah._namemapper']
del sys.modules['Cheetah.Tests.NameMapper'] del sys.modules['Cheetah.Tests.NameMapper']
_setNameMapperFunctions() # restore NameMapper
class NameMapperTest(unittest.TestCase): class NameMapperTest(unittest.TestCase):
def test_valueForName(self): def test_valueForName(self):
from Cheetah.NameMapper import valueForName from Cheetah.NameMapper import valueForName
self.assertEqual(valueForName('upper', 'upper', True), 'UPPER') self.assertEqual(valueForName('upper', 'upper', True), 'UPPER')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
 End of changes. 3 change blocks. 
4 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)