Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9e788af7
Commit
9e788af7
authored
Nov 20, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #25665: Test pickling with all protocols in test_typing.
parents
3129571f
6d9e9239
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Lib/test/test_typing.py
Lib/test/test_typing.py
+10
-8
No files found.
Lib/test/test_typing.py
View file @
9e788af7
...
...
@@ -602,11 +602,12 @@ class GenericTests(TestCase):
c
=
C
()
c
.
foo
=
42
c
.
bar
=
'abc'
z
=
pickle
.
dumps
(
c
)
x
=
pickle
.
loads
(
z
)
self
.
assertEqual
(
x
.
foo
,
42
)
self
.
assertEqual
(
x
.
bar
,
'abc'
)
self
.
assertEqual
(
x
.
__dict__
,
{
'foo'
:
42
,
'bar'
:
'abc'
})
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
z
=
pickle
.
dumps
(
c
,
proto
)
x
=
pickle
.
loads
(
z
)
self
.
assertEqual
(
x
.
foo
,
42
)
self
.
assertEqual
(
x
.
bar
,
'abc'
)
self
.
assertEqual
(
x
.
__dict__
,
{
'foo'
:
42
,
'bar'
:
'abc'
})
def
test_errors
(
self
):
with
self
.
assertRaises
(
TypeError
):
...
...
@@ -1167,9 +1168,10 @@ class NamedTupleTests(TestCase):
global
Emp
# pickle wants to reference the class by name
Emp
=
NamedTuple
(
'Emp'
,
[(
'name'
,
str
),
(
'id'
,
int
)])
jane
=
Emp
(
'jane'
,
37
)
z
=
pickle
.
dumps
(
jane
)
jane2
=
pickle
.
loads
(
z
)
assert
jane
==
jane2
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
z
=
pickle
.
dumps
(
jane
,
proto
)
jane2
=
pickle
.
loads
(
z
)
self
.
assertEqual
(
jane2
,
jane
)
class
IOTests
(
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