Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(8)

Side by Side Diff: Lib/test/pickletester.py

Issue 602: range: lean and mean (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: address more concerns Created 1 year, 6 months ago , Downloaded from: http://bugs.python.org/file10183/range_lean_and_mean5.patch
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 import unittest 1 import unittest
2 import pickle 2 import pickle
3 import pickletools 3 import pickletools
4 import copy_reg 4 import copy_reg
5 5
6 from test.test_support import TestFailed, TESTFN, run_with_locale 6 from test.test_support import TestFailed, TESTFN, run_with_locale
7 7
8 from pickle import bytes_types 8 from pickle import bytes_types
9 9
10 # Tests that try a number of pickle protocols should have a 10 # Tests that try a number of pickle protocols should have a
11 # for proto in protocols: 11 # for proto in protocols:
12 # kind of outer loop. 12 # kind of outer loop.
13 protocols = range(pickle.HIGHEST_PROTOCOL + 1) 13 protocols = list(range(pickle.HIGHEST_PROTOCOL + 1))
14 14
15 15
16 # Return True if opcode code appears in the pickle, else False. 16 # Return True if opcode code appears in the pickle, else False.
17 def opcode_in_pickle(code, pickle): 17 def opcode_in_pickle(code, pickle):
18 for op, dummy, dummy in pickletools.genops(pickle): 18 for op, dummy, dummy in pickletools.genops(pickle):
19 if op.code == code.decode("latin-1"): 19 if op.code == code.decode("latin-1"):
20 return True 20 return True
21 return False 21 return False
22 22
23 # Return the number of times opcode code appears in pickle. 23 # Return the number of times opcode code appears in pickle.
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 for j in range(0, len(p), 20): 1028 for j in range(0, len(p), 20):
1029 b = bytes(p[j:j+20]) 1029 b = bytes(p[j:j+20])
1030 print(" {0!r}".format(b)) 1030 print(" {0!r}".format(b))
1031 print(")") 1031 print(")")
1032 print() 1032 print()
1033 print("# Disassembly of DATA{0}".format(i)) 1033 print("# Disassembly of DATA{0}".format(i))
1034 print("DATA{0}_DIS = \"\"\"\\".format(i)) 1034 print("DATA{0}_DIS = \"\"\"\\".format(i))
1035 dis(p) 1035 dis(p)
1036 print("\"\"\"") 1036 print("\"\"\"")
1037 print() 1037 print()
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483