Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
ca419315
Commit
ca419315
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressed issue #46: fixed test case re: interpolating lambda return values.
parent
02d87ba6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
tests/test_renderengine.py
+12
-4
No files found.
tests/test_renderengine.py
View file @
ca419315
...
...
@@ -243,12 +243,20 @@ class RenderEngineEnderTestCase(unittest.TestCase):
def
test_render__section__lambda__tag_in_output
(
self
):
"""
Check that callable output isn't treated as a template string (issue #46).
Check that callable output is treated as a template string (issue #46).
The spec says--
When used as the data value for a Section tag, the lambda MUST
be treatable as an arity 1 function, and invoked as such (passing
a String containing the unprocessed section contents). The
returned value MUST be rendered against the current delimiters,
then interpolated in place of the section.
"""
template
=
'{{#test}}
Mom
{{/test}}'
context
=
{
'
test'
:
(
lambda
text
:
'{{hi}}
%
s'
%
text
)}
self
.
_assert_render
(
'
{{hi}} Mom
'
,
template
,
context
)
template
=
'{{#test}}
Hi {{person}}
{{/test}}'
context
=
{
'
person'
:
'Mom'
,
'test'
:
(
lambda
text
:
text
+
" :)"
)}
self
.
_assert_render
(
'
Hi Mom :)
'
,
template
,
context
)
def
test_render__section__comment__multiline
(
self
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment