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
49c1d7a9
Commit
49c1d7a9
authored
Apr 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed View dependency from last remaining examples.
parent
8fdbaf27
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
examples/unicode_input.mustache
+2
-2
examples/unicode_input.py
+3
-3
examples/unicode_output.py
+1
-4
tests/test_examples.py
+7
-4
No files found.
examples/unicode_input.mustache
View file @
49c1d7a9
<p>
If alive today, Henri Poincaré would be
{{
age
}}
years old.
</p>
\ No newline at end of file
abcdé
\ No newline at end of file
examples/unicode_input.py
View file @
49c1d7a9
import
pystache
from
pystache
import
TemplateSpec
class
UnicodeInput
(
TemplateSpec
):
class
UnicodeInput
(
pystache
.
View
):
template_path
=
'examples'
template_encoding
=
'utf8'
def
age
(
self
):
...
...
examples/unicode_output.py
View file @
49c1d7a9
# encoding: utf-8
import
pystache
class
UnicodeOutput
(
pystache
.
View
):
template_path
=
'examples'
class
UnicodeOutput
(
object
):
def
name
(
self
):
return
u'Henri Poincaré'
tests/test_examples.py
View file @
49c1d7a9
...
...
@@ -30,11 +30,14 @@ class TestView(unittest.TestCase, AssertStringMixin):
self
.
_assert
(
DoubleSection
(),
u"* first
\n
* second
\n
* third"
)
def
test_unicode_output
(
self
):
self
.
assertEquals
(
UnicodeOutput
()
.
render
(),
u'<p>Name: Henri Poincaré</p>'
)
renderer
=
Renderer
()
actual
=
renderer
.
render
(
UnicodeOutput
())
self
.
assertString
(
actual
,
u'<p>Name: Henri Poincaré</p>'
)
def
test_unicode_input
(
self
):
self
.
assertEquals
(
UnicodeInput
()
.
render
(),
u'<p>If alive today, Henri Poincaré would be 156 years old.</p>'
)
renderer
=
Renderer
()
actual
=
renderer
.
render
(
UnicodeInput
())
self
.
assertString
(
actual
,
u'abcdé'
)
def
test_escaping
(
self
):
self
.
_assert
(
Escaped
(),
u"<h1>Bear > Shark</h1>"
)
...
...
@@ -42,7 +45,7 @@ class TestView(unittest.TestCase, AssertStringMixin):
def
test_literal
(
self
):
renderer
=
Renderer
()
actual
=
renderer
.
render
(
Unescaped
())
self
.
assert
Equals
(
actual
,
"<h1>Bear > Shark</h1>"
)
self
.
assert
String
(
actual
,
u
"<h1>Bear > Shark</h1>"
)
def
test_template_partial
(
self
):
renderer
=
Renderer
(
search_dirs
=
EXAMPLES_DIR
)
...
...
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