# Path: djedi/templatetags/template.py
# def lazy_tag(self, func=None, takes_context=None, name=None, node_class=None):
#     def dec(func):
#             def __init__(self, takes_context, args, kwargs):
#             def get_resolved_arguments(self, context):
#             def render(self, context):
#         class SimpleNode(Node):
# 
# Path: djedi/tests/base.py
# class DjediTest(TransactionTestCase):
# 
#     def setUp(self):
#         from cio.environment import env
#         from cio.backends import cache
#         from cio.pipeline import pipeline
#         from cio.plugins import plugins
# 
#         env.reset()
#         cache.clear()
#         pipeline.clear()
#         plugins.load()
# 
#     def tearDown(self):
#         shutil.rmtree(settings.MEDIA_ROOT, ignore_errors=True)
# 
#     @contextmanager
#     def settings(self, *args, **kwargs):
#         with super(DjediTest, self).settings(*args, **kwargs):
#             with cio_settings():
#                 configure()
#                 yield
# 
# class AssertionMixin(object):
# 
#     def assertKeys(self, dict, *keys):
#         self.assertEqual(set(dict.keys()), set(keys))
# 
#     @contextmanager
#     def assertCache(self, calls=-1, hits=-1, misses=-1, sets=-1):
#         from cio.backends import cache
# 
#         _cache = cache.backend._cache
# 
#         _cache.calls = 0
#         _cache.hits = 0
#         _cache.misses = 0
#         _cache.sets = 0
# 
#         yield
# 
#         if calls >= 0:
#             assert _cache.calls == calls, '%s != %s' % (_cache.calls, calls)
#         if hits >= 0:
#             assert _cache.hits == hits, '%s != %s' % (_cache.hits, hits)
#         if misses >= 0:
#             assert _cache.misses == misses, '%s != %s' % (_cache.misses, misses)
#         if sets >= 0:
#             assert _cache.sets == sets, '%s != %s' % (_cache.sets, sets)
# 
#     @contextmanager
#     def assertDB(self, calls=-1, selects=-1, inserts=-1, updates=-1):
#         from django.db import connection
# 
#         pre_debug_cursor = getattr(connection, DEBUG_CURSOR_ATTR)
#         setattr(connection, DEBUG_CURSOR_ATTR, True)
#         pre_num_queries = len(connection.queries)
# 
#         yield
# 
#         queries = connection.queries[pre_num_queries:]
#         num_queries = len(queries)
#         setattr(connection, DEBUG_CURSOR_ATTR, pre_debug_cursor)
# 
#         if calls >= 0:
#             assert num_queries == calls, '%s != %s' % (num_queries, calls)
#         if selects >= 0:
#             num_selects = len([q for q in queries if q['sql'].startswith('SELECT')])
#             assert num_selects == selects, '%s != %s' % (num_selects, selects)
#         if inserts >= 0:
#             num_inserts = len([q for q in queries if q['sql'].startswith('INSERT')])
#             assert num_inserts == inserts, '%s != %s' % (num_inserts, inserts)
#         if updates >= 0:
#             num_updates = len([q for q in queries if q['sql'].startswith('UPDATE')])
#             assert num_updates == updates, '%s != %s' % (num_updates, updates)
# 
#     def assertRenderedMarkdown(self, value, source):
#         if cio.PY26:
#             self.assertEqual(value, source)  # Markdown lacks Support for python 2.6
#         else:
#             from markdown import markdown
#             rendered = markdown(source)
#             self.assertEqual(value, rendered)
# 
# Path: djedi/tests/compat.py
# def cmpt_context(context):
#     if django.VERSION >= (1, 8):
#         return context
# 
#     from django.template import Context
#     return Context(context)
# 
# def get_template_from_string(template_code):
#     return engines['django'].from_string(template_code)


import cio
from django.contrib.auth.models import User
from django.template import TemplateSyntaxError
from cio.backends import cache
from cio.pipeline import pipeline
from djedi.templatetags.template import register
from djedi.tests.base import DjediTest, AssertionMixin
from .compat import cmpt_context, get_template_from_string
            assert html == u'Hello Jonas Lundberg!'

        html = self.render(u"""
            {% blocknode 'page/title' edit=False %}
                Hello {name}!
            {% endblocknode %}
        """)
        assert html == u'Hej {name}!'

    def test_collected_nodes(self):
        source = u"""
            {% node 'page/title' edit=False %}
            {% node 'page/title' default='fallback' edit=False %}
            {% node 'page/body' edit=False %}
        """
        pipeline.history.clear()
        self.render(source)
        assert len(pipeline.history) == 2

    def test_invalid_lazy_tag(self):
        with self.assertRaises(TemplateSyntaxError):
            register.lazy_tag('')

    def test_lazy_tag(self):
        @register.lazy_tag
        def foo():
            return lambda _: u'bar'
        html = self.render("{% foo %}")
        assert html == u'bar'


# Path: djedi/templatetags/template.py
# def lazy_tag(self, func=None, takes_context=None, name=None, node_class=None):
#     def dec(func):
#             def __init__(self, takes_context, args, kwargs):
#             def get_resolved_arguments(self, context):
#             def render(self, context):
#         class SimpleNode(Node):
# 
# Path: djedi/tests/base.py
# class DjediTest(TransactionTestCase):
# 
#     def setUp(self):
#         from cio.environment import env
#         from cio.backends import cache
#         from cio.pipeline import pipeline
#         from cio.plugins import plugins
# 
#         env.reset()
#         cache.clear()
#         pipeline.clear()
#         plugins.load()
# 
#     def tearDown(self):
#         shutil.rmtree(settings.MEDIA_ROOT, ignore_errors=True)
# 
#     @contextmanager
#     def settings(self, *args, **kwargs):
#         with super(DjediTest, self).settings(*args, **kwargs):
#             with cio_settings():
#                 configure()
#                 yield
# 
# class AssertionMixin(object):
# 
#     def assertKeys(self, dict, *keys):
#         self.assertEqual(set(dict.keys()), set(keys))
# 
#     @contextmanager
#     def assertCache(self, calls=-1, hits=-1, misses=-1, sets=-1):
#         from cio.backends import cache
# 
#         _cache = cache.backend._cache
# 
#         _cache.calls = 0
#         _cache.hits = 0
#         _cache.misses = 0
#         _cache.sets = 0
# 
#         yield
# 
#         if calls >= 0:
#             assert _cache.calls == calls, '%s != %s' % (_cache.calls, calls)
#         if hits >= 0:
#             assert _cache.hits == hits, '%s != %s' % (_cache.hits, hits)
#         if misses >= 0:
#             assert _cache.misses == misses, '%s != %s' % (_cache.misses, misses)
#         if sets >= 0:
#             assert _cache.sets == sets, '%s != %s' % (_cache.sets, sets)
# 
#     @contextmanager
#     def assertDB(self, calls=-1, selects=-1, inserts=-1, updates=-1):
#         from django.db import connection
# 
#         pre_debug_cursor = getattr(connection, DEBUG_CURSOR_ATTR)
#         setattr(connection, DEBUG_CURSOR_ATTR, True)
#         pre_num_queries = len(connection.queries)
# 
#         yield
# 
#         queries = connection.queries[pre_num_queries:]
#         num_queries = len(queries)
#         setattr(connection, DEBUG_CURSOR_ATTR, pre_debug_cursor)
# 
#         if calls >= 0:
#             assert num_queries == calls, '%s != %s' % (num_queries, calls)
#         if selects >= 0:
#             num_selects = len([q for q in queries if q['sql'].startswith('SELECT')])
#             assert num_selects == selects, '%s != %s' % (num_selects, selects)
#         if inserts >= 0:
#             num_inserts = len([q for q in queries if q['sql'].startswith('INSERT')])
#             assert num_inserts == inserts, '%s != %s' % (num_inserts, inserts)
#         if updates >= 0:
#             num_updates = len([q for q in queries if q['sql'].startswith('UPDATE')])
#             assert num_updates == updates, '%s != %s' % (num_updates, updates)
# 
#     def assertRenderedMarkdown(self, value, source):
#         if cio.PY26:
#             self.assertEqual(value, source)  # Markdown lacks Support for python 2.6
#         else:
#             from markdown import markdown
#             rendered = markdown(source)
#             self.assertEqual(value, rendered)
# 
# Path: djedi/tests/compat.py
# def cmpt_context(context):
#     if django.VERSION >= (1, 8):
#         return context
# 
#     from django.template import Context
#     return Context(context)
# 
# def get_template_from_string(template_code):
#     return engines['django'].from_string(template_code)


# Path: djedi/tests/test_templatetags.py
import cio
from django.contrib.auth.models import User
from django.template import TemplateSyntaxError
from cio.backends import cache
from cio.pipeline import pipeline
from djedi.templatetags.template import register
from djedi.tests.base import DjediTest, AssertionMixin
from .compat import cmpt_context, get_template_from_string

            assert html == u'Hello Jonas Lundberg!'

        html = self.render(u"""
            {% blocknode 'page/title' edit=False %}
                Hello {name}!
            {% endblocknode %}
        """)
        assert html == u'Hej {name}!'

    def test_collected_nodes(self):
        source = u"""
            {% node 'page/title' edit=False %}
            {% node 'page/title' default='fallback' edit=False %}
            {% node 'page/body' edit=False %}
        """
        pipeline.history.clear()
        self.render(source)
        assert len(pipeline.history) == 2

    def test_invalid_lazy_tag(self):
        with self.assertRaises(TemplateSyntaxError):
            register.lazy_tag('')

    def test_lazy_tag(self):
        @register.lazy_tag
        def foo():
            return lambda _: u'bar'
        html = self.render("{% foo %}")
        assert html == u'bar'


        @register.lazy_tag()