You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Correct long-literals for Python 2.7
This commit is contained in:
@@ -161,7 +161,9 @@ x = {
|
||||
"return": 12,
|
||||
}
|
||||
|
||||
assert tuple(x.keys()) == ("b", "c", "e", "g", "h", "j", "k", "return")
|
||||
# We need sorted here and below, because x.keys() in 2.7 comes out in the reverse order.
|
||||
# Go figure.
|
||||
assert sorted(x.keys()) == ["b", "c", "e", "g", "h", "j", "k", "return"]
|
||||
|
||||
# Ensure that in dictionary we produce integers, not strings
|
||||
x = {1: 2, 3: 4}
|
||||
@@ -675,7 +677,12 @@ values = {
|
||||
"value502": 502 + 1,
|
||||
}
|
||||
|
||||
assert list(values.values())[1:] == list(range(3, 502 + 2))
|
||||
import sys
|
||||
if sys.version < (3, 0):
|
||||
# Python 2.7 is funky with values.values() ordering
|
||||
assert sorted(values.values())[1:-2] == list(range(4, 502 + 1))
|
||||
else:
|
||||
assert list(values.values())[1:] == list(range(3, 502 + 2))
|
||||
|
||||
# Try a long dictionary that fails because we have a binary op.
|
||||
# We can get a expr32 grouping speedup
|
||||
@@ -717,4 +724,4 @@ values = {
|
||||
"value33": 33,
|
||||
}
|
||||
|
||||
assert list(values.values())[1:] == list(range(2, 34))
|
||||
assert sorted(values.values())[1:] == list(range(2, 34))
|
||||
|
Reference in New Issue
Block a user