# Path: tests/utils.py
# class TemplateTestCase(unittest.TestCase):
#     @classmethod
#     def setUpClass(cls):
#         cls.loader = loader.TemplateLoader([
#             pathlib.Path(__file__).parent / 'templates',
#         ])
# 
#     def assertRendered(self, source, expected, context=None):
#         try:
#             tmpl = compiler.kompile(source, loader=self.loader)
#             rendered = tmpl({} if context is None else context)
#             self.assertEqual(rendered, expected)
#         except Exception as e:
#             if hasattr(e, 'message'):
#                 standardMsg = e.message
#             elif hasattr(e, 'args') and len(e.args) > 0:
#                 standardMsg = e.args[0]
#             else:
#                 standardMsg = ''
#             msg = 'Failed rendering template %s:\n%s: %s' % (
#                 source, e.__class__.__name__, standardMsg)
#             self.fail(msg)
# 
# class Mock(object):
#     def __init__(self, **kwargs):
#         for k, v in kwargs.items():
#             setattr(self, k, v)


from .utils import TemplateTestCase, Mock
        self.assertRendered("Hello world!", 'Hello world!')

    def test_render_plaintext_literal_literal(self):
        self.assertRendered("{{ 'Hello '}}{{ 'world!' }}", 'Hello world!')

    def test_render_plaintext_literal_plaintext(self):
        self.assertRendered("Hello {{ 'world' }}!", 'Hello world!')

    def test_render_literal_plaintext(self):
        self.assertRendered("{{ 'Hello' }} world!", 'Hello world!')

    def test_renderStringLiteral(self):
        self.assertRendered("{{ 'hello' }}", 'hello')

    def test_renderNumLiteral(self):
        # A list of (template, context, output)
        TESTS = (
            ('{{ 23 }}', '23'),

            ('{{ 2.3 }}', '2.3'),
            ('{{ 12.34 }}', '12.34'),
            ('{{ 12e1 }}', '120.0'),
            ('{{ 12E1 }}', '120.0'),
            ('{{ 12e-1 }}', '1.2'),
            ('{{ 12E-1 }}', '1.2'),
        )
        for src, expect in TESTS:
            self.assertRendered(src, expect)



# Path: tests/utils.py
# class TemplateTestCase(unittest.TestCase):
#     @classmethod
#     def setUpClass(cls):
#         cls.loader = loader.TemplateLoader([
#             pathlib.Path(__file__).parent / 'templates',
#         ])
# 
#     def assertRendered(self, source, expected, context=None):
#         try:
#             tmpl = compiler.kompile(source, loader=self.loader)
#             rendered = tmpl({} if context is None else context)
#             self.assertEqual(rendered, expected)
#         except Exception as e:
#             if hasattr(e, 'message'):
#                 standardMsg = e.message
#             elif hasattr(e, 'args') and len(e.args) > 0:
#                 standardMsg = e.args[0]
#             else:
#                 standardMsg = ''
#             msg = 'Failed rendering template %s:\n%s: %s' % (
#                 source, e.__class__.__name__, standardMsg)
#             self.fail(msg)
# 
# class Mock(object):
#     def __init__(self, **kwargs):
#         for k, v in kwargs.items():
#             setattr(self, k, v)


# Path: tests/test_var.py
from .utils import TemplateTestCase, Mock

        self.assertRendered("Hello world!", 'Hello world!')

    def test_render_plaintext_literal_literal(self):
        self.assertRendered("{{ 'Hello '}}{{ 'world!' }}", 'Hello world!')

    def test_render_plaintext_literal_plaintext(self):
        self.assertRendered("Hello {{ 'world' }}!", 'Hello world!')

    def test_render_literal_plaintext(self):
        self.assertRendered("{{ 'Hello' }} world!", 'Hello world!')

    def test_renderStringLiteral(self):
        self.assertRendered("{{ 'hello' }}", 'hello')

    def test_renderNumLiteral(self):
        # A list of (template, context, output)
        TESTS = (
            ('{{ 23 }}', '23'),

            ('{{ 2.3 }}', '2.3'),
            ('{{ 12.34 }}', '12.34'),
            ('{{ 12e1 }}', '120.0'),
            ('{{ 12E1 }}', '120.0'),
            ('{{ 12e-1 }}', '1.2'),
            ('{{ 12E-1 }}', '1.2'),
        )
        for src, expect in TESTS:
            self.assertRendered(src, expect)



class VariableSyntaxTest(TemplateTestCase):