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
dec5054d
Commit
dec5054d
authored
Apr 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the View class from the inverted.py example.
parent
9b6b76c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
examples/inverted.py
+4
-5
tests/test_template_spec.py
+7
-5
No files found.
examples/inverted.py
View file @
dec5054d
import
pystache
from
pystache
import
TemplateSpec
class
Inverted
(
pystache
.
View
):
template_path
=
'examples'
class
Inverted
(
object
):
def
t
(
self
):
return
True
...
...
@@ -14,11 +13,11 @@ class Inverted(pystache.View):
def
empty_list
(
self
):
return
[]
def
populated_list
(
self
):
return
[
'some_value'
]
class
InvertedLists
(
Inverted
):
class
InvertedLists
(
Inverted
,
TemplateSpec
):
template_name
=
'inverted'
def
t
(
self
):
...
...
tests/test_template_spec.py
View file @
dec5054d
...
...
@@ -30,7 +30,7 @@ class Thing(object):
pass
class
ViewTestCase
(
unittest
.
TestCase
):
class
ViewTestCase
(
unittest
.
TestCase
,
AssertStringMixin
):
def
test_init
(
self
):
"""
...
...
@@ -119,8 +119,9 @@ class ViewTestCase(unittest.TestCase):
self
.
assertEquals
(
view
.
render
(),
'nopqrstuvwxyznopqrstuvwxyz'
)
def
test_inverted
(
self
):
view
=
Inverted
()
self
.
assertEquals
(
view
.
render
(),
"""one, two, three, empty list"""
)
renderer
=
Renderer
()
expected
=
renderer
.
render
(
Inverted
())
self
.
assertString
(
expected
,
u"""one, two, three, empty list"""
)
def
test_accessing_properties_on_parent_object_from_child_objects
(
self
):
parent
=
Thing
()
...
...
@@ -132,8 +133,9 @@ class ViewTestCase(unittest.TestCase):
self
.
assertEquals
(
view
.
render
(),
'derp'
)
def
test_inverted_lists
(
self
):
view
=
InvertedLists
()
self
.
assertEquals
(
view
.
render
(),
"""one, two, three, empty list"""
)
renderer
=
Renderer
()
expected
=
renderer
.
render
(
InvertedLists
())
self
.
assertString
(
expected
,
u"""one, two, three, empty list"""
)
class
SpecLoaderTests
(
unittest
.
TestCase
,
AssertIsMixin
,
AssertStringMixin
):
...
...
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