full python 2.5-3.2 compatibility. but 2.5 isn't fully tested, because that's not possible

This commit is contained in:
David Halter
2012-07-13 15:34:51 +02:00
parent 4ee9faacec
commit 8b8b0f920d
4 changed files with 56 additions and 85 deletions

View File

@@ -50,15 +50,15 @@ inst.var
#? ['var_class', 'var_func'] #? ['var_class', 'var_func']
TestClass.var TestClass.var
#? ['real'] #? int()
inst.var_local.real inst.var_local
#? [] #? []
TestClass.var_local.real TestClass.var_local.
#? ['real'] #? int()
TestClass().ret(1).real TestClass().ret(1)
#? ['real'] #? int()
inst.ret(1).real inst.ret(1)
myclass = TestClass(1, '', 3.0) myclass = TestClass(1, '', 3.0)
#? int() #? int()
@@ -67,8 +67,8 @@ myclass.get_first()
myclass.get_first.real myclass.get_first.real
# too many params # too many params
#? ['real'] #? int()
TestClass(1,1,1).var_inst.real TestClass(1,1,1).var_inst
# too few params # too few params
#? int() #? int()
@@ -85,10 +85,10 @@ myclass.second_new
# multiple classes / ordering # multiple classes / ordering
ints = TestClass(1, 1.0) ints = TestClass(1, 1.0)
strs = TestClass("", '') strs = TestClass("", '')
#? ['real'] #? float()
ints.second.real ints.second
#? ['upper'] #? str()
strs.second.upper strs.second
#? ['var_class'] #? ['var_class']
TestClass.var_class.var_class.var_class.var_class TestClass.var_class.var_class.var_class.var_class

View File

@@ -4,33 +4,27 @@
a = "" a = ""
a = 1 a = 1
#? ['real'] #? int()
a.real a
#? []
a.upper
#? [] #? []
a.append a.append
a = list a = list
b = 1; b = "" b = 1; b = ""
#? ['upper'] #? str()
b.upper b
#? []
b.real
a = 1 a = 1
temp = b; temp = b;
b = a b = a
a = temp a = temp
#? ['real'] #? int()
b.real b
#? [] #? int()
b.upper b
#? [] #? str()
a.real a
#? ['upper']
a.upper
a = tuple a = tuple
if 1: if 1:
@@ -45,51 +39,35 @@ a.index
# tuples exchanges # tuples exchanges
# ----------------- # -----------------
a, b = 1, "" a, b = 1, ""
#? ['real'] #? int()
a.real a
#? [] #? str()
a.upper b
#? []
b.real
#? ['upper']
b.upper
b, a = a, b b, a = a, b
#? ['real'] #? int()
b.real b
#? [] #? str()
b.upper a
#? []
a.real
#? ['upper']
a.upper
b, a = a, b b, a = a, b
#? ['real'] #? int()
a.real a
#? [] #? str()
a.upper b
#? []
b.real
#? ['upper']
b.upper
# ----------------- # -----------------
# function stuff # function stuff
# ----------------- # -----------------
def a(a=3): def a(a=3):
#? ['real'] #? int()
a.real a
#? []
a.upper
#? [] #? []
a.func a.func
return a return a
#? ['real'] #? int()
a(2).real a(2)
#? []
a(2).upper
#? [] #? []
a(2).func a(2).func
# ----------------- # -----------------
@@ -98,22 +76,16 @@ a(2).func
class A(object): class A(object):
a = "" a = ""
a = 3 a = 3
#? ['real'] #? int()
a.real a
#? [] # TODO remove this line!!
a.upper
#? []
a.append
a = list() a = list()
def __init__(self): def __init__(self):
self.b = "" self.b = ""
self.b = 3 self.b = 3
#? ['real'] # TODO should this be so?
self.b.real #? int() str() list()
##? [] self.b
self.b.upper
##? []
self.b.append
self.b = list self.b = list
@@ -147,12 +119,8 @@ a.append
#? [] #? []
a.real a.real
#? ['append'] #? list() str() int()
a.a.append a.a
#? ['real']
a.a.real
#? ['upper']
a.a.upper
# ----------------- # -----------------
# class stuff # class stuff
@@ -166,8 +134,8 @@ math.cosh
math.real math.real
math = 3 math = 3
#? ['real'] #? int()
math.real math
#? [] #? []
math.cos math.cos
@@ -180,5 +148,5 @@ from math import *
cosh.real cosh.real
cosh = 3 cosh = 3
#? ['real'] #? int()
cosh.real cosh

View File

@@ -54,8 +54,8 @@ dic2 = {'asdf': 3}
#? ['popitem'] #? ['popitem']
dic2.popitem dic2.popitem
#? ['real'] #? int()
dic2['asdf'].real dic2['asdf']
# ----------------- # -----------------
# set # set

View File

@@ -126,6 +126,9 @@ def test_dir(completion_test_dir, third_party=False):
global tests_pass global tests_pass
for f_name in os.listdir(completion_test_dir): for f_name in os.listdir(completion_test_dir):
if len(sys.argv) == 1 or [a for a in sys.argv[1:] if a in f_name]: if len(sys.argv) == 1 or [a for a in sys.argv[1:] if a in f_name]:
if sys.hexversion < 0x02060000 \
and f_name in ['generators.py', 'types.py']:
continue
if f_name.endswith(".py"): if f_name.endswith(".py"):
if third_party: if third_party:
try: try: