Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
0faa2d6e
Commit
0faa2d6e
authored
Feb 09, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for misses in 'get'.
parent
1ea87abc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
src/OFS/tests/testObjectManager.py
src/OFS/tests/testObjectManager.py
+13
-10
No files found.
src/OFS/tests/testObjectManager.py
View file @
0faa2d6e
...
@@ -412,19 +412,22 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
...
@@ -412,19 +412,22 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om
=
self
.
_makeOne
()
om
=
self
.
_makeOne
()
self
.
assertTrue
(
om
)
self
.
assertTrue
(
om
)
def
test_get
(
self
):
def
test_get_miss_wo_default
(
self
):
om
=
self
.
_makeOne
()
self
.
assertEqual
(
om
.
get
(
'nonesuch'
),
None
)
def
test_get_miss_w_default
(
self
):
om
=
self
.
_makeOne
()
obj
=
object
()
self
.
assertTrue
(
om
.
get
(
'nonesuch'
,
obj
)
is
obj
)
def
test_get_hit
(
self
):
om
=
self
.
_makeOne
()
om
=
self
.
_makeOne
()
si1
=
SimpleItem
(
'1'
)
si1
=
SimpleItem
(
'1'
)
om
[
'1'
]
=
si1
om
[
'1'
]
=
si1
self
.
assertTrue
(
om
.
get
(
'1'
)
==
si1
)
got
=
om
.
get
(
'1'
)
# A contained item overwrites the method
self
.
assertTrue
(
got
.
aq_self
is
si1
)
self
.
assertTrue
(
hasattr
(
om
.
get
,
'im_func'
))
self
.
assertTrue
(
got
.
aq_parent
is
om
)
om
.
__dict__
[
'get'
]
=
si1
self
.
assertTrue
(
aq_base
(
om
.
get
)
is
si1
)
self
.
assertTrue
(
aq_base
(
om
[
'get'
])
is
si1
)
# Once the object is gone, the method is back
del
om
[
'get'
]
self
.
assertTrue
(
hasattr
(
om
.
get
,
'im_func'
))
def
test_items
(
self
):
def
test_items
(
self
):
om
=
self
.
_makeOne
()
om
=
self
.
_makeOne
()
...
...
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