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
3fbae97b
Commit
3fbae97b
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue_20' into development: closing issue #20
parents
a5de2eb2
2a3d4158
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
tests/test_renderengine.py
+22
-3
No files found.
tests/test_renderengine.py
View file @
3fbae97b
...
...
@@ -10,6 +10,7 @@ import unittest
from
pystache.context
import
Context
from
pystache.renderengine
import
RenderEngine
from
tests.common
import
assert_strings
class
RenderEngineTestCase
(
unittest
.
TestCase
):
...
...
@@ -29,9 +30,16 @@ class RenderEngineTestCase(unittest.TestCase):
self
.
assertEquals
(
engine
.
load_partial
,
"foo"
)
class
Render
EngineEnderTestCase
(
unittest
.
TestCase
):
class
Render
Tests
(
unittest
.
TestCase
):
"""Test RenderEngine.render()."""
"""
Tests RenderEngine.render().
Explicit spec-test-like tests best go in this class since the
RenderEngine class contains all parsing logic. This way, the unit tests
will be more focused and fail "closer to the code".
"""
def
_engine
(
self
):
"""
...
...
@@ -57,7 +65,7 @@ class RenderEngineEnderTestCase(unittest.TestCase):
actual
=
engine
.
render
(
template
,
context
)
self
.
assertEquals
(
actual
,
expected
)
assert_strings
(
test_case
=
self
,
actual
=
actual
,
expected
=
expected
)
def
test_render
(
self
):
self
.
_assert_render
(
'Hi Mom'
,
'Hi {{person}}'
,
{
'person'
:
'Mom'
})
...
...
@@ -266,3 +274,14 @@ class RenderEngineEnderTestCase(unittest.TestCase):
self
.
_assert_render
(
'foobar'
,
'foo{{! baz }}bar'
)
self
.
_assert_render
(
'foobar'
,
'foo{{!
\n
baz }}bar'
)
def
test_custom_delimiters__sections
(
self
):
"""
Check that custom delimiters can be used to start a section.
Test case for issue #20: https://github.com/defunkt/pystache/issues/20
"""
template
=
'{{=[[ ]]=}}[[#foo]]bar[[/foo]]'
context
=
{
'foo'
:
True
}
self
.
_assert_render
(
"bar"
,
template
,
context
)
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