1 # -*- coding: utf-8 -*-
6 All the unittests of Jinja2. These tests can be executed by
7 either running run-tests.py using multiple Python versions at
10 :copyright: (c) 2010 by the Jinja Team.
11 :license: BSD, see LICENSE for more details.
16 from jinja2 import loaders
19 here = os.path.dirname(os.path.abspath(__file__))
21 dict_loader = loaders.DictLoader({
22 'justdict.html': 'FOO'
24 package_loader = loaders.PackageLoader('jinja2.testsuite.res', 'templates')
25 filesystem_loader = loaders.FileSystemLoader(here + 'res/templates')
26 function_loader = loaders.FunctionLoader({'justfunction.html': 'FOO'}.get)
27 choice_loader = loaders.ChoiceLoader([dict_loader, package_loader])
28 prefix_loader = loaders.PrefixLoader({
29 'a': filesystem_loader,
34 class JinjaTestCase(unittest.TestCase):
36 ### use only these methods for testing. If you need standard
37 ### unittest method, wrap them!
39 def assert_equal(self, a, b):
40 return self.assertEqual(a, b)
42 def assert_raises(self, *args, **kwargs):
43 return self.assertRaises(*args, **kwargs)
47 from jinja2.testsuite import ext, filters
48 suite = unittest.TestSuite()
49 suite.addTest(ext.suite())
50 suite.addTest(filters.suite())