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
78ca9df1
Commit
78ca9df1
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed spacing issues on partial test cases: trailing newline for standalones.
parent
ca419315
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
10 deletions
+37
-10
examples/inner_partial.txt
+2
-1
tests/common.py
+14
-0
tests/test_examples.py
+5
-5
tests/test_simple.py
+16
-4
No files found.
examples/inner_partial.txt
View file @
78ca9df1
## Again, {{title}}! ##
## Again, {{title}}! ##
\ No newline at end of file
tests/common.py
View file @
78ca9df1
...
...
@@ -13,3 +13,17 @@ DATA_DIR = 'tests/data'
def
get_data_path
(
file_name
):
return
os
.
path
.
join
(
DATA_DIR
,
file_name
)
def
assert_strings
(
test_case
,
actual
,
expected
):
# Show both friendly and literal versions.
message
=
"""
\
Expected:
\"
""
%
s
\"
""
Actual:
\"
""
%
s
\"
""
Expected:
%
s
Actual:
%
s"""
%
(
expected
,
actual
,
repr
(
expected
),
repr
(
actual
))
test_case
.
assertEquals
(
actual
,
expected
,
message
)
tests/test_examples.py
View file @
78ca9df1
...
...
@@ -13,6 +13,9 @@ from examples.unicode_output import UnicodeOutput
from
examples.unicode_input
import
UnicodeInput
from
examples.nested_context
import
NestedContext
from
tests.common
import
assert_strings
class
TestView
(
unittest
.
TestCase
):
def
test_comments
(
self
):
self
.
assertEquals
(
Comments
()
.
render
(),
"""<h1>A Comedy of Errors</h1>
...
...
@@ -47,13 +50,10 @@ Again, Welcome!""")
def
test_template_partial_extension
(
self
):
view
=
TemplatePartial
()
view
.
template_extension
=
'txt'
self
.
assertEquals
(
view
.
render
(),
"""Welcome
assert_strings
(
self
,
view
.
render
(),
u
"""Welcome
-------
## Again, Welcome! ##
"""
)
## Again, Welcome! ##"""
)
def
test_delimiters
(
self
):
self
.
assertEquals
(
Delimiters
()
.
render
(),
"""
...
...
tests/test_simple.py
View file @
78ca9df1
import
unittest
import
pystache
from
pystache
import
Renderer
from
examples.nested_context
import
NestedContext
...
...
@@ -7,6 +8,9 @@ from examples.lambdas import Lambdas
from
examples.template_partial
import
TemplatePartial
from
examples.simple
import
Simple
from
tests.common
import
assert_strings
class
TestSimple
(
unittest
.
TestCase
):
def
test_nested_context
(
self
):
...
...
@@ -44,11 +48,19 @@ class TestSimple(unittest.TestCase):
def
test_template_partial_extension
(
self
):
"""
Side note:
From the spec--
Partial tags SHOULD be treated as standalone when appropriate.
In particular, this means that trailing newlines should be removed.
"""
view
=
TemplatePartial
()
view
.
template_extension
=
'txt'
self
.
assertEquals
(
view
.
render
(),
"""Welcome
assert_strings
(
self
,
view
.
render
(),
u
"""Welcome
-------
## Again, Welcome! ##
"""
)
## Again, Welcome! ##"""
)
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