# Path: mako/runtime.py
# class Context:
# class CallerStack(list):
# class Undefined:
# class LoopStack:
# class LoopContext:
# class _NSAttr:
# class Namespace:
# class TemplateNamespace(Namespace):
# class ModuleNamespace(Namespace):
#     def __init__(self, buffer, **data):
#     def _set_with_template(self, t):
#     def lookup(self):
#     def kwargs(self):
#     def push_caller(self, caller):
#     def pop_caller(self):
#     def keys(self):
#     def __getitem__(self, key):
#     def _push_writer(self):
#     def _pop_buffer_and_writer(self):
#     def _push_buffer(self):
#     def _pop_buffer(self):
#     def get(self, key, default=None):
#     def write(self, string):
#     def writer(self):
#     def _copy(self):
#     def _locals(self, d):
#     def _clean_inheritance_tokens(self):
#     def __init__(self):
#     def __nonzero__(self):
#     def __bool__(self):
#     def _get_caller(self):
#     def __getattr__(self, key):
#     def _push_frame(self):
#     def _pop_frame(self):
#     def __str__(self):
#     def __nonzero__(self):
#     def __bool__(self):
#     def __init__(self):
#     def _enter(self, iterable):
#     def _exit(self):
#     def _top(self):
#     def _pop(self):
#     def _push(self, iterable):
#     def __getattr__(self, key):
#     def __iter__(self):
#     def __init__(self, iterable):
#     def __iter__(self):
#     def __len__(self):
#     def reverse_index(self):
#     def first(self):
#     def last(self):
#     def even(self):
#     def odd(self):
#     def cycle(self, *values):
#     def __init__(self, parent):
#     def __getattr__(self, key):
#     def __init__(
#         self,
#         name,
#         context,
#         callables=None,
#         inherits=None,
#         populate_self=True,
#         calling_uri=None,
#     ):
#     def attr(self):
#     def get_namespace(self, uri):
#     def get_template(self, uri):
#     def get_cached(self, key, **kwargs):
#     def cache(self):
#     def include_file(self, uri, **kwargs):
#     def _populate(self, d, l):
#     def _get_star(self):
#     def __getattr__(self, key):
#     def __init__(
#         self,
#         name,
#         context,
#         template=None,
#         templateuri=None,
#         callables=None,
#         inherits=None,
#         populate_self=True,
#         calling_uri=None,
#     ):
#     def module(self):
#     def filename(self):
#     def uri(self):
#     def _get_star(self):
#         def get(key):
#     def __getattr__(self, key):
#     def __init__(
#         self,
#         name,
#         context,
#         module,
#         callables=None,
#         inherits=None,
#         populate_self=True,
#         calling_uri=None,
#     ):
#     def filename(self):
#     def _get_star(self):
#     def __getattr__(self, key):
# def supports_caller(func):
#     def wrap_stackframe(context, *args, **kwargs):
# def capture(context, callable_, *args, **kwargs):
# def _decorate_toplevel(fn):
#     def decorate_render(render_fn):
#         def go(context, *args, **kw):
#             def y(*args, **kw):
# def _decorate_inline(context, fn):
#     def decorate_render(render_fn):
#         def go(*args, **kw):
# def _include_file(context, uri, calling_uri, **kwargs):
# def _inherit_from(context, uri, calling_uri):
# def _lookup_template(context, uri, relativeto):
# def _populate_self_namespace(context, template, self_ns=None):
# def _render(template, callable_, args, data, as_unicode=False):
# def _kwargs_for_callable(callable_, data):
# def _kwargs_for_include(callable_, data, **kwargs):
# def _render_context(tmpl, callable_, context, *args, **kwargs):
# def _exec_template(callable_, context, args=None, kwargs=None):
# def _render_error(template, context, error):
# UNDEFINED = Undefined()
# STOP_RENDERING = ""
# 
# Path: mako/testing/assertions.py
# def eq_(a, b, msg=None):
#     """Assert a == b, with repr messaging on failure."""
#     assert a == b, msg or "%r != %r" % (a, b)


from mako import runtime
from mako.testing.assertions import eq_
"""Assorted runtime unit tests
"""


class ContextTest:
    def test_locals_kwargs(self):
        c = runtime.Context(None, foo="bar")
        eq_(c.kwargs, {"foo": "bar"})

        d = c._locals({"zig": "zag"})

        # kwargs is the original args sent to the Context,
        # it's intentionally kept separate from _data
        eq_(c.kwargs, {"foo": "bar"})

# Path: mako/runtime.py
# class Context:
# class CallerStack(list):
# class Undefined:
# class LoopStack:
# class LoopContext:
# class _NSAttr:
# class Namespace:
# class TemplateNamespace(Namespace):
# class ModuleNamespace(Namespace):
#     def __init__(self, buffer, **data):
#     def _set_with_template(self, t):
#     def lookup(self):
#     def kwargs(self):
#     def push_caller(self, caller):
#     def pop_caller(self):
#     def keys(self):
#     def __getitem__(self, key):
#     def _push_writer(self):
#     def _pop_buffer_and_writer(self):
#     def _push_buffer(self):
#     def _pop_buffer(self):
#     def get(self, key, default=None):
#     def write(self, string):
#     def writer(self):
#     def _copy(self):
#     def _locals(self, d):
#     def _clean_inheritance_tokens(self):
#     def __init__(self):
#     def __nonzero__(self):
#     def __bool__(self):
#     def _get_caller(self):
#     def __getattr__(self, key):
#     def _push_frame(self):
#     def _pop_frame(self):
#     def __str__(self):
#     def __nonzero__(self):
#     def __bool__(self):
#     def __init__(self):
#     def _enter(self, iterable):
#     def _exit(self):
#     def _top(self):
#     def _pop(self):
#     def _push(self, iterable):
#     def __getattr__(self, key):
#     def __iter__(self):
#     def __init__(self, iterable):
#     def __iter__(self):
#     def __len__(self):
#     def reverse_index(self):
#     def first(self):
#     def last(self):
#     def even(self):
#     def odd(self):
#     def cycle(self, *values):
#     def __init__(self, parent):
#     def __getattr__(self, key):
#     def __init__(
#         self,
#         name,
#         context,
#         callables=None,
#         inherits=None,
#         populate_self=True,
#         calling_uri=None,
#     ):
#     def attr(self):
#     def get_namespace(self, uri):
#     def get_template(self, uri):
#     def get_cached(self, key, **kwargs):
#     def cache(self):
#     def include_file(self, uri, **kwargs):
#     def _populate(self, d, l):
#     def _get_star(self):
#     def __getattr__(self, key):
#     def __init__(
#         self,
#         name,
#         context,
#         template=None,
#         templateuri=None,
#         callables=None,
#         inherits=None,
#         populate_self=True,
#         calling_uri=None,
#     ):
#     def module(self):
#     def filename(self):
#     def uri(self):
#     def _get_star(self):
#         def get(key):
#     def __getattr__(self, key):
#     def __init__(
#         self,
#         name,
#         context,
#         module,
#         callables=None,
#         inherits=None,
#         populate_self=True,
#         calling_uri=None,
#     ):
#     def filename(self):
#     def _get_star(self):
#     def __getattr__(self, key):
# def supports_caller(func):
#     def wrap_stackframe(context, *args, **kwargs):
# def capture(context, callable_, *args, **kwargs):
# def _decorate_toplevel(fn):
#     def decorate_render(render_fn):
#         def go(context, *args, **kw):
#             def y(*args, **kw):
# def _decorate_inline(context, fn):
#     def decorate_render(render_fn):
#         def go(*args, **kw):
# def _include_file(context, uri, calling_uri, **kwargs):
# def _inherit_from(context, uri, calling_uri):
# def _lookup_template(context, uri, relativeto):
# def _populate_self_namespace(context, template, self_ns=None):
# def _render(template, callable_, args, data, as_unicode=False):
# def _kwargs_for_callable(callable_, data):
# def _kwargs_for_include(callable_, data, **kwargs):
# def _render_context(tmpl, callable_, context, *args, **kwargs):
# def _exec_template(callable_, context, args=None, kwargs=None):
# def _render_error(template, context, error):
# UNDEFINED = Undefined()
# STOP_RENDERING = ""
# 
# Path: mako/testing/assertions.py
# def eq_(a, b, msg=None):
#     """Assert a == b, with repr messaging on failure."""
#     assert a == b, msg or "%r != %r" % (a, b)


# Path: test/test_runtime.py
from mako import runtime
from mako.testing.assertions import eq_

"""Assorted runtime unit tests
"""


class ContextTest:
    def test_locals_kwargs(self):
        c = runtime.Context(None, foo="bar")
        eq_(c.kwargs, {"foo": "bar"})

        d = c._locals({"zig": "zag"})

        # kwargs is the original args sent to the Context,
        # it's intentionally kept separate from _data
        eq_(c.kwargs, {"foo": "bar"})

        eq_(d.kwargs, {"foo": "bar"})