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
b05d6f85
Commit
b05d6f85
authored
Dec 21, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some redundant tests from test_template, and moved one to test_renderengine.
parent
b885d029
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
51 deletions
+18
-51
tests/test_renderengine.py
+18
-0
tests/test_template.py
+0
-51
No files found.
tests/test_renderengine.py
View file @
b05d6f85
...
...
@@ -117,3 +117,21 @@ class RenderEngineTestCase(unittest.TestCase):
self
.
_assert_render
(
'**bar BAR'
,
'{{>partial}}'
,
{
'foo'
:
'bar'
},
engine
=
engine
,
partials
=
partials
)
def
test_render__list_referencing_outer_context
(
self
):
"""
Check that list items can access the parent context.
For sections whose value is a list, check that items in the list
have access to the values inherited from the parent context
when rendering.
"""
context
=
{
"list"
:
[{
"name"
:
"Al"
},
{
"name"
:
"Bo"
}],
"greeting"
:
"Hi"
,
}
template
=
"{{#list}}{{name}}: {{greeting}}; {{/list}}"
self
.
_assert_render
(
"Al: Hi; Bo: Hi; "
,
template
,
context
)
tests/test_template.py
View file @
b05d6f85
...
...
@@ -256,57 +256,6 @@ class TemplateTestCase(unittest.TestCase):
actual
=
template
.
render
(
context
)
self
.
assertEquals
(
actual
,
'{{hi}} Mom'
)
def
test_render__html_escape
(
self
):
context
=
{
'test'
:
'1 < 2'
}
template
=
Template
(
'{{test}}'
)
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
def
test_render__html_escape_disabled
(
self
):
context
=
{
'test'
:
'1 < 2'
}
template
=
Template
(
'{{test}}'
)
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
template
.
escape
=
lambda
s
:
s
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
def
test_render__html_escape_disabled_with_partial
(
self
):
context
=
{
'test'
:
'1 < 2'
}
load_template
=
lambda
name
:
'{{test}}'
template
=
Template
(
'{{>partial}}'
,
load_template
=
load_template
)
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
template
.
escape
=
lambda
s
:
s
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
def
test_render__html_escape_disabled_with_non_false_value
(
self
):
context
=
{
'section'
:
{
'test'
:
'1 < 2'
}}
template
=
Template
(
'{{#section}}{{test}}{{/section}}'
)
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
template
.
escape
=
lambda
s
:
s
self
.
assertEquals
(
template
.
render
(
context
),
'1 < 2'
)
def
test_render__list_referencing_outer_context
(
self
):
"""
Check that list items can access the parent context.
For sections whose value is a list, check that items in the list
have access to the values inherited from the parent context
when rendering.
"""
context
=
{
"list"
:
[{
"name"
:
"Al"
},
{
"name"
:
"Bo"
}],
"greeting"
:
"Hi"
,
}
template
=
Template
(
"{{#list}}{{name}}: {{greeting}}; {{/list}}"
)
self
.
assertEquals
(
template
.
render
(
context
),
"Al: Hi; Bo: Hi; "
)
def
test_render__nonascii_template
(
self
):
"""
Test passing a non-unicode template with non-ascii characters.
...
...
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