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
e5b1faab
Commit
e5b1faab
authored
May 04, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unittest warnings with Python 3: assertEquals() is deprecated.
parent
661b3ecd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
pystache/tests/test_context.py
+5
-5
No files found.
pystache/tests/test_context.py
View file @
e5b1faab
...
...
@@ -408,18 +408,18 @@ class ContextStackTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
def
test_dot_notation__user_object
(
self
):
name
=
"foo.bar"
stack
=
ContextStack
({
"foo"
:
Attachable
(
bar
=
"baz"
)})
self
.
assertEqual
s
(
stack
.
get
(
name
),
"baz"
)
self
.
assertEqual
(
stack
.
get
(
name
),
"baz"
)
# Works on multiple levels, too
name
=
"a.b.c.d.e.f.g"
A
=
Attachable
stack
=
ContextStack
({
"a"
:
A
(
b
=
A
(
c
=
A
(
d
=
A
(
e
=
A
(
f
=
A
(
g
=
"w00t!"
))))))})
self
.
assertEqual
s
(
stack
.
get
(
name
),
"w00t!"
)
self
.
assertEqual
(
stack
.
get
(
name
),
"w00t!"
)
def
test_dot_notation__mixed_dict_and_obj
(
self
):
name
=
"foo.bar.baz.bak"
stack
=
ContextStack
({
"foo"
:
Attachable
(
bar
=
{
"baz"
:
Attachable
(
bak
=
42
)})})
self
.
assertEqual
s
(
stack
.
get
(
name
),
42
)
self
.
assertEqual
(
stack
.
get
(
name
),
42
)
def
test_dot_notation__missing_attr_or_key
(
self
):
name
=
"foo.bar.baz.bak"
...
...
@@ -460,11 +460,11 @@ class ContextStackTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
# When any element in the path is callable, it should be automatically invoked
stack
=
ContextStack
({
"foo"
:
Attachable
(
bar
=
Attachable
(
baz
=
lambda
:
"Called!"
))})
self
.
assertEqual
s
(
stack
.
get
(
name
),
"Called!"
)
self
.
assertEqual
(
stack
.
get
(
name
),
"Called!"
)
class
Foo
(
object
):
def
bar
(
self
):
return
Attachable
(
baz
=
'Baz'
)
stack
=
ContextStack
({
"foo"
:
Foo
()})
self
.
assertEqual
s
(
stack
.
get
(
name
),
"Baz"
)
self
.
assertEqual
(
stack
.
get
(
name
),
"Baz"
)
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