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
84f08042
Commit
84f08042
authored
Dec 18, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some unit tests for Template.render().
parent
499e3d2c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tests/test_template.py
+23
-0
No files found.
tests/test_template.py
View file @
84f08042
...
...
@@ -5,6 +5,7 @@ Unit tests of template.py.
"""
import
codecs
import
unittest
from
pystache.template
import
Template
...
...
@@ -31,3 +32,25 @@ class TemplateTestCase(unittest.TestCase):
template
=
Template
(
context
=
context
,
foo
=
"bar"
)
self
.
assertEquals
(
context
,
{})
def
test_render__unicode
(
self
):
template
=
Template
(
u'foo'
)
actual
=
template
.
render
()
self
.
assertTrue
(
isinstance
(
actual
,
unicode
))
self
.
assertEquals
(
actual
,
u'foo'
)
def
test_render__str
(
self
):
template
=
Template
(
'foo'
)
actual
=
template
.
render
()
self
.
assertTrue
(
isinstance
(
actual
,
str
))
self
.
assertEquals
(
actual
,
'foo'
)
def
test_render__context
(
self
):
template
=
Template
(
'Hi {{person}}'
,
{
'person'
:
'Mom'
})
self
.
assertEquals
(
template
.
render
(),
'Hi Mom'
)
def
test_render__output_encoding
(
self
):
template
=
Template
(
u'Poincaré'
)
actual
=
template
.
render
(
'utf-8'
)
self
.
assertTrue
(
isinstance
(
actual
,
str
))
self
.
assertEquals
(
actual
,
'Poincaré'
)
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