# 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)


import pathlib
from .utils import TemplateTestCase




class InheritanceTestCase(TemplateTestCase):

    def test_simple(self):
        '''
        Test that we can inherit.
        '''
        t = self.loader.load('inherit_simple.html')
        output = t({})
        self.assertEqual(output, 'parent\n\n')

    def test_override_block(self):
        t = self.loader.load('inherit_override.html')
        output = t({})
        self.assertEqual(output, 'parent\nchild\n')



# 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)


# Path: tests/test_inheritance.py
import pathlib
from .utils import TemplateTestCase





class InheritanceTestCase(TemplateTestCase):

    def test_simple(self):
        '''
        Test that we can inherit.
        '''
        t = self.loader.load('inherit_simple.html')
        output = t({})
        self.assertEqual(output, 'parent\n\n')

    def test_override_block(self):
        t = self.loader.load('inherit_override.html')
        output = t({})
        self.assertEqual(output, 'parent\nchild\n')



class SuperTestCase(TemplateTestCase):