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
d5df7f15
Commit
d5df7f15
authored
Apr 03, 2012
by
Rodrigo Bernardo Pimentel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding simple tests for dot notation
parent
3460b417
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
tests/test_simple.py
+19
-0
No files found.
tests/test_simple.py
View file @
d5df7f15
...
...
@@ -60,6 +60,25 @@ class TestSimple(unittest.TestCase, AssertStringMixin):
template
=
'{{not_set}} {{blank}}'
self
.
assertEquals
(
pystache
.
Renderer
()
.
render
(
template
),
' '
)
def
test_dot_notation_with_dict
(
self
):
template
=
'Name: {{person.name}}. Age: {{person.details.age}}. Intimate details (should be empty): {{person.details.intimate}}.'
renderer
=
Renderer
()
context
=
{
'person'
:
{
'name'
:
'Biggles'
,
'details'
:
{
'age'
:
42
}}}
actual
=
renderer
.
render
(
template
,
context
)
self
.
assertEquals
(
actual
,
'Name: Biggles. Age: 42. Intimate details (should be empty): .'
)
def
test_dot_notation_with_user_objects
(
self
):
template
=
'Name: {{person.name}}. Age: {{person.details.age}}. Intimate details (should be empty): {{person.details.intimate}}.'
renderer
=
Renderer
()
class
Person
(
object
):
def
__init__
(
self
,
name
,
details
):
self
.
name
=
name
self
.
details
=
details
context
=
{
'person'
:
Person
(
'Biggles'
,
{
'age'
:
42
})}
actual
=
renderer
.
render
(
template
,
context
)
self
.
assertEquals
(
actual
,
'Name: Biggles. Age: 42. Intimate details (should be empty): .'
)
def
test_template_partial_extension
(
self
):
"""
...
...
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