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
f5e9950b
Commit
f5e9950b
authored
Dec 23, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a test case for issue #15: (non-list) "non-false value"
parent
a6cf2b10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
tests/test_pystache.py
+18
-0
No files found.
tests/test_pystache.py
View file @
f5e9950b
...
...
@@ -15,6 +15,10 @@ class PystacheTests(object):
"""
def
_assert_rendered
(
self
,
expected
,
template
,
context
):
actual
=
pystache
.
render
(
template
,
context
)
self
.
assertEquals
(
actual
,
expected
)
def
test_basic
(
self
):
ret
=
pystache
.
render
(
"Hi {{thing}}!"
,
{
'thing'
:
'world'
})
self
.
assertEquals
(
ret
,
"Hi world!"
)
...
...
@@ -94,6 +98,20 @@ class PystacheTests(object):
ret
=
pystache
.
render
(
template
,
{
"spacing"
:
True
})
self
.
assertEquals
(
ret
,
"first second third"
)
def
test__section__non_false_value
(
self
):
"""
Test when a section value is a (non-list) "non-false value".
From mustache(5):
When the value [of a section key] is non-false but not a list, it
will be used as the context for a single rendering of the block.
"""
template
=
"""{{#person}}Hi {{name}}{{/person}}"""
context
=
{
"person"
:
{
"name"
:
"Jon"
}}
self
.
_assert_rendered
(
"Hi Jon"
,
template
,
context
)
def
test_later_list_section_with_escapable_character
(
self
):
"""
This is a simple test case intended to cover issue #53.
...
...
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