-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [bug] The Context.locals_() method becomes a private underscored
method, as this method has a specific internal use. The purpose of Context.kwargs has been clarified, in that it only delivers top level keyword arguments originally passed to template.render(). [ticket:219]
- Loading branch information
Showing
5 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Assorted runtime unit tests | ||
""" | ||
from mako import runtime | ||
import unittest | ||
from . 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') | ||
|
||
|