Move more tests into the new framework, including current xfails.

This commit is contained in:
Michael Hansen
2019-10-07 12:00:30 -07:00
parent 0dc49b5872
commit ab58fba23b
63 changed files with 652 additions and 17 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,7 +2,7 @@ class MyClass:
def method(self, i):
if i is 5:
print 'five'
elif not (i is 2):
elif i is not 2:
print 'not two'
else:
print '2'

View File

@@ -1,6 +1,11 @@
from __future__ import division
print ' 1 // 2 =', 1 // 2
print '1.0 // 2.0 =', 1.0 // 2.0
print ' 1 / 2 =', 1 / 2
print '1.0 / 2.0 =', 1.0 / 2.0
ai = 1
bi = 2
af = 1.5
bf = 2.5
print ' 1 // 2 =', ai // bi
print '1.5 // 2.5 =', af // bf
print ' 1 / 2 =', ai / bi
print '1.5 / 2.5 =', af / bf

View File

@@ -1,4 +1,9 @@
print ' 1 // 2 =', 1 // 2
print '1.0 // 2.0 =', 1.0 // 2.0
print ' 1 / 2 =', 1 / 2
print '1.0 / 2.0 =', 1.0 / 2.0
ai = 1
bi = 2
af = 1.5
bf = 2.5
print ' 1 // 2 =', ai // bi
print '1.5 // 2.5 =', af // bf
print ' 1 / 2 =', ai / bi
print '1.5 / 2.5 =', af / bf

View File

@@ -0,0 +1,25 @@
def kwfunc ( ** kwargs ) : <EOL>
<INDENT>
print kwargs . items ( ) <EOL>
<OUTDENT>
def argsfunc ( * args ) : <EOL>
<INDENT>
print args <EOL>
<OUTDENT>
def no_apply ( * args , ** kwargs ) : <EOL>
<INDENT>
print args <EOL>
print kwargs . items ( ) <EOL>
argsfunc ( 34 ) <EOL>
foo = argsfunc ( * args ) <EOL>
argsfunc ( * args ) <EOL>
argsfunc ( 34 , * args ) <EOL>
kwfunc ( ** kwargs ) <EOL>
kwfunc ( x = 11 , ** kwargs ) <EOL>
no_apply ( * args , ** kwargs ) <EOL>
no_apply ( 34 , * args , ** kwargs ) <EOL>
no_apply ( x = 11 , * args , ** kwargs ) <EOL>
no_apply ( 34 , x = 11 , * args , ** kwargs ) <EOL>
no_apply ( 42 , 34 , x = 11 , * args , ** kwargs ) <EOL>
<OUTDENT>
no_apply ( 1 , 2 , 4 , 8 , a = 2 , b = 3 , c = 5 ) <EOL>

View File

@@ -0,0 +1,61 @@
'\naugmentedAssign.py -- source test pattern for augmented assigns\n\nThis source is part of the decompyle test suite.\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
raise 'This program can\'t be run' <EOL>
a = 1 <EOL>
b = 2 <EOL>
a += b <EOL>
print a <EOL>
a -= b <EOL>
print a <EOL>
a *= b <EOL>
print a <EOL>
a -= a <EOL>
print a <EOL>
a += 7 * 3 <EOL>
print a <EOL>
l = [ 1 , 2 , 3 ] <EOL>
l [ 1 ] *= 3 <EOL>
print l [ 1 ] <EOL>
l [ 1 ] [ 2 ] [ 3 ] = 7 <EOL>
l [ 1 ] [ 2 ] [ 3 ] *= 3 <EOL>
l [ : ] += [ 9 ] <EOL>
print l <EOL>
l [ : 2 ] += [ 9 ] <EOL>
print l <EOL>
l [ 1 : ] += [ 9 ] <EOL>
print l <EOL>
l [ 1 : 4 ] += [ 9 ] <EOL>
print l <EOL>
l += [ 42 , 43 ] <EOL>
print l <EOL>
a . value = 1 <EOL>
a . value += 1 <EOL>
a . b . val = 1 <EOL>
a . b . val += 1 <EOL>
l = [ ] <EOL>
for i in range ( 3 ) : <EOL>
<INDENT>
lj = [ ] <EOL>
for j in range ( 3 ) : <EOL>
<INDENT>
lk = [ ] <EOL>
for k in range ( 3 ) : <EOL>
<INDENT>
lk . append ( 0 ) <EOL>
<OUTDENT>
lj . append ( lk ) <EOL>
<OUTDENT>
l . append ( lj ) <EOL>
<OUTDENT>
i = 1 <EOL>
j = 1 <EOL>
k = 1 <EOL>
def f ( ) : <EOL>
<INDENT>
global i <EOL>
i += 1 <EOL>
return i <EOL>
<OUTDENT>
l [ i ] [ j ] [ k ] = 1 <EOL>
i = 1 <EOL>
l [ f ( ) ] [ j ] [ k ] += 1 <EOL>
print i , l <EOL>

View File

@@ -0,0 +1,15 @@
class MyClass : <EOL>
<INDENT>
def method ( self , i ) : <EOL>
<INDENT>
if i is 5 : <EOL>
<INDENT>
print 'five' <EOL>
<OUTDENT>
elif i is not 2 : <EOL>
<INDENT>
print 'not two' <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
print '2' <EOL>

View File

@@ -1,5 +1,9 @@
from __future__ import division <EOL>
print ' 1 // 2 =' , 1 // 2 <EOL>
print '1.0 // 2.0 =' , 1.0 // 2.0 <EOL>
print ' 1 / 2 =' , 1 / 2 <EOL>
print '1.0 / 2.0 =' , 1.0 / 2.0 <EOL>
ai = 1 <EOL>
bi = 2 <EOL>
af = 1.5 <EOL>
bf = 2.5 <EOL>
print ' 1 // 2 =' , ai // bi <EOL>
print '1.5 // 2.5 =' , af // bf <EOL>
print ' 1 / 2 =' , ai / bi <EOL>
print '1.5 / 2.5 =' , af / bf <EOL>

View File

@@ -1,4 +1,8 @@
print ' 1 // 2 =' , 1 // 2 <EOL>
print '1.0 // 2.0 =' , 1.0 // 2.0 <EOL>
print ' 1 / 2 =' , 1 / 2 <EOL>
print '1.0 / 2.0 =' , 1.0 / 2.0 <EOL>
ai = 1 <EOL>
bi = 2 <EOL>
af = 1.5 <EOL>
bf = 2.5 <EOL>
print ' 1 // 2 =' , ai // bi <EOL>
print '1.5 // 2.5 =' , af // bf <EOL>
print ' 1 / 2 =' , ai / bi <EOL>
print '1.5 / 2.5 =' , af / bf <EOL>

View File

@@ -0,0 +1,168 @@
import dis <EOL>
def x11 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try except' <EOL>
<OUTDENT>
except : <EOL>
<INDENT>
a = 2 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x12 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try except else(pass)' <EOL>
<OUTDENT>
except : <EOL>
<INDENT>
a = 2 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x13 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try except else(a=3)' <EOL>
<OUTDENT>
except : <EOL>
<INDENT>
a = 2 <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
a = 3 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x21 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try KeyError' <EOL>
<OUTDENT>
except KeyError : <EOL>
<INDENT>
a = 8 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x22 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try (IdxErr, KeyError) else(pass)' <EOL>
<OUTDENT>
except ( IndexError , KeyError ) : <EOL>
<INDENT>
a = 8 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x23 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try KeyError else(a=9)' <EOL>
<OUTDENT>
except KeyError : <EOL>
<INDENT>
a = 8 <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
a = 9 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x31 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try KeyError IndexError' <EOL>
<OUTDENT>
except KeyError : <EOL>
<INDENT>
a = 8 <EOL>
<OUTDENT>
except IndexError : <EOL>
<INDENT>
a = 9 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x32 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try KeyError IndexError else(pass)' <EOL>
<OUTDENT>
except KeyError : <EOL>
<INDENT>
a = 8 <EOL>
<OUTDENT>
except IndexError : <EOL>
<INDENT>
a = 9 <EOL>
<OUTDENT>
b = '--------' <EOL>
<OUTDENT>
def x33 ( ) : <EOL>
<INDENT>
try : <EOL>
<INDENT>
a = 'try KeyError IndexError else(a=9)' <EOL>
<OUTDENT>
except KeyError : <EOL>
<INDENT>
a = 8 <EOL>
<OUTDENT>
except IndexError : <EOL>
<INDENT>
a = 9 <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
a = 9 <EOL>
<OUTDENT>
b = '#################' <EOL>
<OUTDENT>
def x41 ( ) : <EOL>
<INDENT>
if a == 1 : <EOL>
<INDENT>
a = 1 <EOL>
<OUTDENT>
elif b == 1 : <EOL>
<INDENT>
b = 1 <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
c = 1 <EOL>
<OUTDENT>
b = '#################' <EOL>
<OUTDENT>
def x42 ( ) : <EOL>
<INDENT>
if a == 1 : <EOL>
<INDENT>
a = 1 <EOL>
<OUTDENT>
elif b == 1 : <EOL>
<INDENT>
b = 1 <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
c = 1 <EOL>
<OUTDENT>
xxx = 'mmm' <EOL>
<OUTDENT>
if __name__ == '__main__' : <EOL>
<INDENT>
dis . dis ( xx ) <EOL>

View File

@@ -0,0 +1,65 @@
def x0 ( ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x1 ( arg1 ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x2 ( arg1 , arg2 ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x3a ( * args ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x3b ( ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x3c ( * args , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x4a ( foo , bar = 1 , bla = 2 , * args ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x4b ( foo , bar = 1 , bla = 2 , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x4c ( foo , bar = 1 , bla = 2 , * args , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def func_with_tuple_args ( ( a , b ) ) : <EOL>
<INDENT>
print a <EOL>
print b <EOL>
<OUTDENT>
def func_with_tuple_args2 ( ( a , b ) , ( c , d ) ) : <EOL>
<INDENT>
print a <EOL>
print c <EOL>
<OUTDENT>
def func_with_tuple_args3 ( ( a , b ) , ( c , d ) , * args ) : <EOL>
<INDENT>
print a <EOL>
print c <EOL>
<OUTDENT>
def func_with_tuple_args4 ( ( a , b ) , ( c , d ) , ** kwargs ) : <EOL>
<INDENT>
print a <EOL>
print c <EOL>
<OUTDENT>
def func_with_tuple_args5 ( ( a , b ) , ( c , d ) , * args , ** kwargs ) : <EOL>
<INDENT>
print a <EOL>
print c <EOL>
<OUTDENT>
def func_with_tuple_args6 ( ( a , b ) , ( c , d ) = ( 2 , 3 ) , * args , ** kwargs ) : <EOL>
<INDENT>
print a <EOL>
print c <EOL>

View File

@@ -0,0 +1,12 @@
'\ntest_import.py -- source test pattern for import statements\n\nThis source is part of the decompyle test suite.\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
import sys <EOL>
import os <EOL>
import sys <EOL>
import BaseHTTPServer <EOL>
import test . test_MimeWriter <EOL>
from rfc822 import Message <EOL>
from mimetools import Message , decode , choose_boundary <EOL>
from os import * <EOL>
for k , v in globals ( ) . items ( ) : <EOL>
<INDENT>
print ` k ` , v <EOL>

View File

@@ -0,0 +1,20 @@
'\ntest_integers.py -- source test pattern for integers\n\nThis source is part of the decompyle test suite.\nSnippet taken from python libs\'s test_class.py\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
import sys <EOL>
i = 1 <EOL>
i = 42 <EOL>
i = - 1 <EOL>
i = - 42 <EOL>
i = sys . maxint <EOL>
minint = - ( sys . maxint ) - 1 <EOL>
print sys . maxint <EOL>
print minint <EOL>
print long ( minint ) - 1 <EOL>
print <EOL>
i = - 2147483647 <EOL>
print i , repr ( i ) <EOL>
i = i - 1 <EOL>
print i , repr ( i ) <EOL>
i = - 0 x80000000L <EOL>
print i , repr ( i ) <EOL>
i = - 0 x80000001L <EOL>
print i , repr ( i ) <EOL>

View File

@@ -0,0 +1,7 @@
palette = map ( lambda a : ( a , a , a ) , range ( 256 ) ) <EOL>
palette = map ( lambda ( r , g , b ) : chr ( r ) + chr ( g ) + chr ( b ) , palette ) <EOL>
palette = map ( lambda r : r , palette ) <EOL>
palette = lambda ( r , g , b ) : r <EOL>
palette = lambda ( r ) : r <EOL>
palette = lambda r : r <EOL>
palette = ( lambda ( r ) : r , palette ) <EOL>

View File

@@ -0,0 +1,62 @@
'\ntest_loops.py -- source test pattern for loops\n\nThis source is part of the decompyle test suite.\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
for i in range ( 10 ) : <EOL>
<INDENT>
if i == 3 : <EOL>
<INDENT>
continue <EOL>
<OUTDENT>
if i == 5 : <EOL>
<INDENT>
break <EOL>
<OUTDENT>
print i , <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
print 'Else' <EOL>
<OUTDENT>
print <EOL>
for i in range ( 10 ) : <EOL>
<INDENT>
if i == 3 : <EOL>
<INDENT>
continue <EOL>
<OUTDENT>
print i , <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
print 'Else' <EOL>
<OUTDENT>
i = 0 <EOL>
while i < 10 : <EOL>
<INDENT>
i = i + 1 <EOL>
if i == 3 : <EOL>
<INDENT>
continue <EOL>
<OUTDENT>
if i == 5 : <EOL>
<INDENT>
break <EOL>
<OUTDENT>
print i , <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
print 'Else' <EOL>
<OUTDENT>
print <EOL>
i = 0 <EOL>
while i < 10 : <EOL>
<INDENT>
i = i + 1 <EOL>
if i == 3 : <EOL>
<INDENT>
continue <EOL>
<OUTDENT>
print i , <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
print 'Else' <EOL>

View File

@@ -0,0 +1,12 @@
'\ntest_loops2.py -- source test pattern for loops (CONTINUE_LOOP)\n\nThis source is part of the decompyle test suite.\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
for term in args : <EOL>
<INDENT>
try : <EOL>
<INDENT>
print <EOL>
continue <EOL>
print <EOL>
<OUTDENT>
except : <EOL>
<INDENT>
pass <EOL>

View File

@@ -0,0 +1,125 @@
from __future__ import nested_scopes <EOL>
blurb = 1 <EOL>
def k0 ( ) : <EOL>
<INDENT>
def l0 ( m = 1 ) : <EOL>
<INDENT>
print <EOL>
<OUTDENT>
l0 ( ) <EOL>
<OUTDENT>
def x0 ( ) : <EOL>
<INDENT>
def y0 ( ) : <EOL>
<INDENT>
print <EOL>
<OUTDENT>
y0 ( ) <EOL>
<OUTDENT>
def x1 ( ) : <EOL>
<INDENT>
def y1 ( ) : <EOL>
<INDENT>
print 'y-blurb =' , blurb <EOL>
<OUTDENT>
y1 ( ) <EOL>
<OUTDENT>
def x2 ( ) : <EOL>
<INDENT>
def y2 ( ) : <EOL>
<INDENT>
print <EOL>
<OUTDENT>
blurb = 2 <EOL>
y2 ( ) <EOL>
<OUTDENT>
def x3a ( ) : <EOL>
<INDENT>
def y3a ( x ) : <EOL>
<INDENT>
print 'y-blurb =' , blurb , flurb <EOL>
<OUTDENT>
print <EOL>
blurb = 3 <EOL>
flurb = 7 <EOL>
y3a ( 1 ) <EOL>
print 'x3a-blurb =' , blurb <EOL>
<OUTDENT>
def x3 ( ) : <EOL>
<INDENT>
def y3 ( x ) : <EOL>
<INDENT>
def z ( ) : <EOL>
<INDENT>
blurb = 25 <EOL>
print 'z-blurb =' , blurb , <EOL>
<OUTDENT>
z ( ) <EOL>
print 'y-blurb =' , blurb , <EOL>
<OUTDENT>
print <EOL>
blurb = 3 <EOL>
y3 ( 1 ) <EOL>
print 'x3-blurb =' , blurb <EOL>
<OUTDENT>
def x3b ( ) : <EOL>
<INDENT>
def y3b ( x ) : <EOL>
<INDENT>
def z ( ) : <EOL>
<INDENT>
print 'z-blurb =' , blurb , <EOL>
<OUTDENT>
blurb = 25 <EOL>
z ( ) <EOL>
print 'y-blurb =' , blurb , <EOL>
<OUTDENT>
print <EOL>
blurb = 3 <EOL>
y3b ( 1 ) <EOL>
print 'x3-blurb =' , blurb <EOL>
<OUTDENT>
def x4 ( ) : <EOL>
<INDENT>
global blurb <EOL>
def y4 ( x ) : <EOL>
<INDENT>
def z ( ) : <EOL>
<INDENT>
print 'z-blurb =' , blurb <EOL>
<OUTDENT>
z ( ) <EOL>
<OUTDENT>
blurb = 3 <EOL>
y4 ( 1 ) <EOL>
<OUTDENT>
def x ( ) : <EOL>
<INDENT>
def y ( x ) : <EOL>
<INDENT>
print 'y-blurb =' , blurb <EOL>
<OUTDENT>
blurb = 2 <EOL>
y ( 1 ) <EOL>
<OUTDENT>
def func_with_tuple_args6 ( ( a , b ) , ( c , d ) = ( 2 , 3 ) , * args , ** kwargs ) : <EOL>
<INDENT>
def y ( x ) : <EOL>
<INDENT>
print 'y-a =' , a <EOL>
<OUTDENT>
print c <EOL>
<OUTDENT>
def find ( self , name ) : <EOL>
<INDENT>
L = filter ( ( lambda x , name : x == name ) , self . list_attribute ) <EOL>
<OUTDENT>
x0 ( ) <EOL>
x1 ( ) <EOL>
x2 ( ) <EOL>
x3 ( ) <EOL>
x3a ( ) <EOL>
x3b ( ) <EOL>
x4 ( ) <EOL>
x ( ) <EOL>
print 'blurb =' , blurb <EOL>

View File

@@ -0,0 +1,26 @@
'\ntest_slices.py -- source test pattern for slices\n\nThis source is part of the decompyle test suite.\nSnippet taken from python libs\'s test_class.py\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
raise 'This program can\'t be run' <EOL>
testme [ 1 ] <EOL>
testme [ 1 ] = 1 <EOL>
del testme [ 1 ] <EOL>
testme [ : 42 ] <EOL>
testme [ : 42 ] = 'The Answer' <EOL>
del testme [ : 42 ] <EOL>
testme [ 2 : 1024 : ] <EOL>
testme [ : 1024 : 10 ] <EOL>
testme [ : : ] <EOL>
testme [ 2 : 1024 : 10 ] <EOL>
testme [ 2 : 1024 : 10 ] = 'A lot' <EOL>
del testme [ 2 : 1024 : 10 ] <EOL>
testme [ ( : 42 , ... , : 24 : , 24 , 100 ) ] <EOL>
testme [ ( : 42 , ... , : 24 : , 24 , 100 ) ] = 'Strange' <EOL>
del testme [ ( : 42 , ... , : 24 : , 24 , 100 ) ] <EOL>
testme [ : ] <EOL>
testme [ : ] = 'Take all' <EOL>
del testme [ : ] <EOL>
testme [ 40 : 42 ] <EOL>
testme [ 40 : 42 ] = 'Three' <EOL>
del testme [ 40 : 42 ] <EOL>
testme [ ( 40 , 41 , 42 ) ] <EOL>
testme [ ( 40 , 41 , 42 ) ] = 'Another Three' <EOL>
del testme [ ( 40 , 41 , 42 ) ] <EOL>

View File

@@ -0,0 +1,19 @@
'\ntest_tuples.py -- source test pattern for tuples\n\nThis source is part of the decompyle test suite.\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
a = ( 1 , ) <EOL>
b = ( 2 , 3 ) <EOL>
( a , b ) = ( 1 , 2 ) <EOL>
( a , b ) = ( ( 1 , 2 ) , ( 3 , 4 , 5 ) ) <EOL>
x = { } <EOL>
try : <EOL>
<INDENT>
x [ ( 1 , 2 , 3 ) ] <EOL>
<OUTDENT>
except : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
x [ ( 1 , 2 , 3 ) ] = 42 <EOL>
print x [ ( 1 , 2 , 3 ) ] <EOL>
print x [ ( 1 , 2 , 3 ) ] <EOL>
assert x [ ( 1 , 2 , 3 ) ] == x [ ( 1 , 2 , 3 ) ] <EOL>
del x [ ( 1 , 2 , 3 ) ] <EOL>