Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Nicolas Wavrant
ZODB
Commits
f9d6bfd1
Commit
f9d6bfd1
authored
May 01, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add explicit test for noload() of list-based references.
parent
2807a969
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
src/ZODB/tests/testSerialize.py
src/ZODB/tests/testSerialize.py
+26
-1
No files found.
src/ZODB/tests/testSerialize.py
View file @
f9d6bfd1
...
...
@@ -15,10 +15,15 @@ import doctest
import
sys
import
unittest
from
persistent
import
Persistent
from
persistent.wref
import
WeakRef
import
ZODB.tests.util
from
ZODB
import
serialize
from
ZODB._compat
import
Pickler
,
BytesIO
,
_protocol
,
IS_JYTHON
from
ZODB._compat
import
Pickler
,
PersistentUnpickler
,
BytesIO
,
_protocol
,
IS_JYTHON
class
PersistentObject
(
Persistent
):
pass
class
ClassWithNewargs
(
int
):
def
__new__
(
cls
,
value
):
...
...
@@ -118,6 +123,26 @@ class SerializerTestCase(unittest.TestCase):
self
.
assertTrue
(
not
serialize
.
myhasattr
(
OldStyle
(),
"rat"
))
self
.
assertTrue
(
not
serialize
.
myhasattr
(
NewStyle
(),
"rat"
))
def
test_persistent_id_noload
(
self
):
# make sure we can noload weak references and other list-based
# references like we expect. Protect explicitly against the
# breakage in CPython 2.7 and zodbpickle < 0.6.0
o
=
PersistentObject
()
o
.
_p_oid
=
b'abcd'
top
=
PersistentObject
()
top
.
_p_oid
=
b'efgh'
top
.
ref
=
WeakRef
(
o
)
pickle
=
serialize
.
ObjectWriter
().
serialize
(
top
)
refs
=
[]
u
=
PersistentUnpickler
(
None
,
refs
.
append
,
BytesIO
(
pickle
))
u
.
noload
()
u
.
noload
()
self
.
assertEqual
(
refs
,
[[
'w'
,
(
b'abcd'
,)]])
class
SerializerFunctestCase
(
unittest
.
TestCase
):
...
...
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