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
370d5254
Commit
370d5254
authored
Mar 19, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DoubleSection and Escaped tests no longer depend on pystache.View.
parent
17d70ba6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
+12
-15
examples/double_section.py
+1
-4
examples/escaped.py
+1
-4
tests/test_examples.py
+10
-7
No files found.
examples/double_section.py
View file @
370d5254
import
pystache
class
DoubleSection
(
object
):
class
DoubleSection
(
pystache
.
View
):
template_path
=
'examples'
def
t
(
self
):
def
t
(
self
):
return
True
return
True
...
...
examples/escaped.py
View file @
370d5254
import
pystache
class
Escaped
(
object
):
class
Escaped
(
pystache
.
View
):
template_path
=
'examples'
def
title
(
self
):
def
title
(
self
):
return
"Bear > Shark"
return
"Bear > Shark"
tests/test_examples.py
View file @
370d5254
...
@@ -17,13 +17,16 @@ from tests.common import assert_strings
...
@@ -17,13 +17,16 @@ from tests.common import assert_strings
class
TestView
(
unittest
.
TestCase
):
class
TestView
(
unittest
.
TestCase
):
def
test_comments
(
self
):
def
_assert
(
self
,
obj
,
expected
):
renderer
=
Renderer
()
renderer
=
Renderer
()
expected
=
renderer
.
render
(
Comments
())
actual
=
renderer
.
render
(
obj
)
self
.
assertEquals
(
expected
,
"<h1>A Comedy of Errors</h1>"
)
assert_strings
(
self
,
actual
,
expected
)
def
test_comments
(
self
):
self
.
_assert
(
Comments
(),
"<h1>A Comedy of Errors</h1>"
)
def
test_double_section
(
self
):
def
test_double_section
(
self
):
self
.
assertEquals
(
DoubleSection
()
.
render
(),
"""* first
\n
* second
\n
* third""
"
)
self
.
_assert
(
DoubleSection
(),
"* first
\n
* second
\n
* third
"
)
def
test_unicode_output
(
self
):
def
test_unicode_output
(
self
):
self
.
assertEquals
(
UnicodeOutput
()
.
render
(),
u'<p>Name: Henri Poincaré</p>'
)
self
.
assertEquals
(
UnicodeOutput
()
.
render
(),
u'<p>Name: Henri Poincaré</p>'
)
...
@@ -33,7 +36,7 @@ class TestView(unittest.TestCase):
...
@@ -33,7 +36,7 @@ class TestView(unittest.TestCase):
u'<p>If alive today, Henri Poincaré would be 156 years old.</p>'
)
u'<p>If alive today, Henri Poincaré would be 156 years old.</p>'
)
def
test_escaping
(
self
):
def
test_escaping
(
self
):
self
.
assertEquals
(
Escaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
self
.
_assert
(
Escaped
(),
"<h1>Bear > Shark</h1>"
)
def
test_literal
(
self
):
def
test_literal
(
self
):
self
.
assertEquals
(
Unescaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
self
.
assertEquals
(
Unescaped
()
.
render
(),
"<h1>Bear > Shark</h1>"
)
...
@@ -52,8 +55,8 @@ Again, Welcome!""")
...
@@ -52,8 +55,8 @@ Again, Welcome!""")
def
test_delimiters
(
self
):
def
test_delimiters
(
self
):
renderer
=
Renderer
()
renderer
=
Renderer
()
expected
=
renderer
.
render
(
Delimiters
())
actual
=
renderer
.
render
(
Delimiters
())
assert_strings
(
self
,
expected
,
"""
\
assert_strings
(
self
,
actual
,
"""
\
* It worked the first time.
* It worked the first time.
* And it worked the second time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.
* Then, surprisingly, it worked the third time.
...
...
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