aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_runtime.py
blob: d87d264a3e7f2ce2761f6264d97da63dbb413830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Assorted runtime unit tests
"""
import unittest

from mako import runtime
from test import eq_


class ContextTest(unittest.TestCase):
    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"})

        eq_(d._data["zig"], "zag")