-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Here's how it is defined right now:
Lines 640 to 655 in 837ba05
def test_pickling(self): | |
import pickle | |
mods = [pickle] | |
try: | |
import cPickle | |
mods.append(cPickle) | |
except ImportError: | |
pass | |
protocols = [0, 1, 2] | |
for mod in mods: | |
for protocol in protocols: | |
for ast in (compile(i, "?", "exec", 0x400) for i in exec_tests): | |
ast2 = mod.loads(mod.dumps(ast, protocol)) | |
self.assertEqual(to_tuple(ast2), to_tuple(ast)) | |
def test_invalid_sum(self): |
I see two major problems here:
cPickle
does not exist anymore (since 3.0), so it always fails withImportError
. If we want to be sure that both Python and C versions behave the same - we can surely do that withimport_helper.import_fresh_module
or we can drop this part and only keeppickle
module direct usage (as other modules do). I prefer the second option, because of how other things are tested. But, in the end it is up to maintainers to decide :)- Not all
pickle
protocols are tested: we need to usepickle.HIGHEST_PROTOCOL
instead of just three items
PR is incoming!
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error