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
c4afa10c
Commit
c4afa10c
authored
May 15, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the picklevalue test; it broke due to the change in default protocol.
parent
1bc535dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
Lib/test/test_bool.py
Lib/test/test_bool.py
+15
-9
No files found.
Lib/test/test_bool.py
View file @
c4afa10c
...
...
@@ -299,19 +299,25 @@ class BoolTest(unittest.TestCase):
def
test_picklevalues
(
self
):
# Test for specific backwards-compatible pickle values
import
pickle
self
.
assertEqual
(
pickle
.
dumps
(
True
),
"I01
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
False
),
"I00
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
True
,
True
),
"I01
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
False
,
True
),
"I00
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
True
,
protocol
=
0
),
b"I01
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
False
,
protocol
=
0
),
b"I00
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
True
,
protocol
=
1
),
b"I01
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
False
,
protocol
=
1
),
b"I00
\
n
."
)
self
.
assertEqual
(
pickle
.
dumps
(
True
,
protocol
=
2
),
b'
\
x80
\
x02
\
x88
.'
)
self
.
assertEqual
(
pickle
.
dumps
(
False
,
protocol
=
2
),
b'
\
x80
\
x02
\
x89
.'
)
def
test_cpicklevalues
(
self
):
# Test for specific backwards-compatible pickle values
try
:
import
cPickle
except
ImportError
:
return
# Just ignore the rest if cPickle doesn't exist
self
.
assertEqual
(
cPickle
.
dumps
(
True
),
"I01
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
),
"I00
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
True
,
True
),
"I01
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
True
),
"I00
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
True
,
protocol
=
0
),
b"I01
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
protocol
=
0
),
b"I00
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
True
,
protocol
=
1
),
b"I01
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
protocol
=
1
),
b"I00
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
True
,
protocol
=
2
),
b'
\
x80
\
x02
\
x88
.'
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
protocol
=
2
),
b'
\
x80
\
x02
\
x89
.'
)
def
test_convert_to_bool
(
self
):
# Verify that TypeError occurs when bad things are returned
...
...
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