Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
transaction
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
transaction
Commits
cd1a1adf
Commit
cd1a1adf
authored
Dec 18, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for 'oid_hint'.
parent
c881c9f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
transaction/_transaction.py
transaction/_transaction.py
+3
-2
transaction/tests/test__transaction.py
transaction/tests/test__transaction.py
+15
-0
No files found.
transaction/_transaction.py
View file @
cd1a1adf
...
@@ -559,13 +559,14 @@ def object_hint(o):
...
@@ -559,13 +559,14 @@ def object_hint(o):
This function does not raise an exception.
This function does not raise an exception.
"""
"""
# We should always be able to get __class__.
# We should always be able to get __class__.
klass
=
o
.
__class__
.
__name__
klass
=
o
.
__class__
.
__name__
# oid would be great, but may this isn't a persistent object.
# oid would be great, but may
be
this isn't a persistent object.
oid
=
getattr
(
o
,
"_p_oid"
,
_marker
)
oid
=
getattr
(
o
,
"_p_oid"
,
_marker
)
if
oid
is
not
_marker
:
if
oid
is
not
_marker
:
oid
=
oid_repr
(
oid
)
oid
=
oid_repr
(
oid
)
else
:
oid
=
'None'
return
"%s oid=%s"
%
(
klass
,
oid
)
return
"%s oid=%s"
%
(
klass
,
oid
)
def
oid_repr
(
oid
):
def
oid_repr
(
oid
):
...
...
transaction/tests/test__transaction.py
View file @
cd1a1adf
...
@@ -1092,6 +1092,21 @@ class MiscellaneousTests(unittest.TestCase):
...
@@ -1092,6 +1092,21 @@ class MiscellaneousTests(unittest.TestCase):
from
transaction._transaction
import
rm_key
from
transaction._transaction
import
rm_key
self
.
assertEqual
(
rm_key
(
Resource
(
'zzz'
)),
'zzz'
)
self
.
assertEqual
(
rm_key
(
Resource
(
'zzz'
)),
'zzz'
)
def
test_object_hint_miss
(
self
):
from
transaction._transaction
import
object_hint
class
_Test
(
object
):
pass
test
=
_Test
()
self
.
assertEqual
(
object_hint
(
test
),
"_Test oid=None"
)
def
test_object_hint_hit
(
self
):
from
transaction._transaction
import
object_hint
class
_Test
(
object
):
pass
test
=
_Test
()
test
.
_p_oid
=
'OID'
self
.
assertEqual
(
object_hint
(
test
),
"_Test oid='OID'"
)
def
test_BBB_join
(
self
):
def
test_BBB_join
(
self
):
# The join method is provided for "backward-compatability" with ZODB 4
# The join method is provided for "backward-compatability" with ZODB 4
# data managers.
# data managers.
...
...
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