[pypy-commit] pypy default: random test fixes after cleanups
bdkearns
noreply at buildbot.pypy.org
Fri Mar 22 11:43:18 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r62655:8c91ef2675de
Date: 2013-03-22 06:42 -0400
http://bitbucket.org/pypy/pypy/changeset/8c91ef2675de/
Log: random test fixes after cleanups
diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -6,7 +6,8 @@
from rpython.annotator import model as annmodel
from rpython.annotator.annrpython import RPythonAnnotator as _RPythonAnnotator
from rpython.translator.translator import graphof as tgraphof
-from rpython.annotator import policy
+from rpython.annotator.policy import AnnotatorPolicy
+from rpython.annotator.signature import Sig
from rpython.annotator.listdef import ListDef, ListChangeUnallowed
from rpython.annotator.dictdef import DictDef
from rpython.flowspace.model import *
@@ -686,17 +687,17 @@
assert s == a.bookkeeper.immutablevalue(42)
def test_call_star_args(self):
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
s = a.build_types(snippet.call_star_args, [int])
assert s.knowntype == int
def test_call_star_args_multiple(self):
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
s = a.build_types(snippet.call_star_args_multiple, [int])
assert s.knowntype == int
def test_class_spec(self):
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
s = a.build_types(snippet.class_spec, [])
assert s.items[0].knowntype == int
assert s.items[1].knowntype == str
@@ -705,7 +706,7 @@
x = snippet.PolyStk()
def f():
return x
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
py.test.raises(Exception, a.build_types, f, [])
def test_exception_deduction_with_raise1(self):
@@ -2789,7 +2790,7 @@
def fun(x, y):
return x+y
s_nonneg = annmodel.SomeInteger(nonneg=True)
- fun._annenforceargs_ = policy.Sig(int, s_nonneg)
+ fun._annenforceargs_ = Sig(int, s_nonneg)
a = self.RPythonAnnotator()
s = a.build_types(fun, [s_nonneg, s_nonneg])
@@ -2813,7 +2814,7 @@
def fun(x, y):
return y
s_nonneg = annmodel.SomeInteger(nonneg=True)
- fun._annenforceargs_ = policy.Sig(lambda s1,s2: s1, lambda s1,s2: s1)
+ fun._annenforceargs_ = Sig(lambda s1,s2: s1, lambda s1,s2: s1)
# means: the 2nd argument's annotation becomes the 1st argument's
# input annotation
@@ -3016,7 +3017,7 @@
x > y,
x >= y)
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
s = a.build_types(fun, [float, float])
assert [s_item.knowntype for s_item in s.items] == [bool] * 6
@@ -3029,14 +3030,14 @@
def fun():
return g([])
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
s = a.build_types(fun, [])
assert s.const == 0
def test_compare_int_bool(self):
def fun(x):
return 50 < x
- a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ a = self.RPythonAnnotator(policy=AnnotatorPolicy())
s = a.build_types(fun, [bool])
assert isinstance(s, annmodel.SomeBool)
@@ -3049,7 +3050,7 @@
else:
v = -maxint
return intmask(v * 10)
- P = policy.AnnotatorPolicy()
+ P = AnnotatorPolicy()
a = self.RPythonAnnotator(policy=P)
s = a.build_types(fun, [bool])
assert isinstance(s, annmodel.SomeInteger)
@@ -3153,8 +3154,6 @@
py.test.raises(AssertionError, a.build_types, f, [])
def test_ctr_location(self):
- from rpython.rlib.jit import hint
-
class A:
_annspecialcase_ = 'specialize:ctr_location'
def __init__(self, x):
diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py
--- a/rpython/annotator/test/test_model.py
+++ b/rpython/annotator/test/test_model.py
@@ -1,7 +1,8 @@
import py
+
from rpython.annotator.model import *
from rpython.annotator.listdef import ListDef
-from rpython.rtyper.ootypesystem.ootype import ROOT
+from rpython.rtyper.ootypesystem import ootype
listdef1 = ListDef(None, SomeTuple([SomeInteger(nonneg=True), SomeString()]))
@@ -114,7 +115,7 @@
assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltype.Ptr(S)
s_p = ll_to_annotation(lltype.malloc(A, 0))
assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltype.Ptr(A)
- C = ootype.Instance('C', ROOT, {})
+ C = ootype.Instance('C', ootype.ROOT, {})
s_p = ll_to_annotation(ootype.new(C))
assert isinstance(s_p, SomeOOInstance) and s_p.ootype == C
@@ -139,7 +140,7 @@
s_p = SomePtr(ll_ptrtype=PS)
assert annotation_to_lltype(s_p) == PS
py.test.raises(ValueError, "annotation_to_lltype(si0)")
- C = ootype.Instance('C', ROOT, {})
+ C = ootype.Instance('C', ootype.ROOT, {})
ref = SomeOOInstance(C)
assert annotation_to_lltype(ref) == C
s_singlefloat = SomeSingleFloat()
@@ -172,10 +173,10 @@
py.test.raises(AssertionError, "unionof(SomeObject(), SomePtr(PS1))")
def test_oo_union():
- C1 = ootype.Instance("C1", ROOT)
+ C1 = ootype.Instance("C1", ootype.ROOT)
C2 = ootype.Instance("C2", C1)
C3 = ootype.Instance("C3", C1)
- D = ootype.Instance("D", ROOT)
+ D = ootype.Instance("D", ootype.ROOT)
assert unionof(SomeOOInstance(C1), SomeOOInstance(C1)) == SomeOOInstance(C1)
assert unionof(SomeOOInstance(C1), SomeOOInstance(C2)) == SomeOOInstance(C1)
assert unionof(SomeOOInstance(C2), SomeOOInstance(C1)) == SomeOOInstance(C1)
@@ -184,7 +185,7 @@
assert unionof(SomeOOInstance(C1),SomeImpossibleValue()) == SomeOOInstance(C1)
assert unionof(SomeImpossibleValue(), SomeOOInstance(C1)) == SomeOOInstance(C1)
- assert unionof(SomeOOInstance(C1), SomeOOInstance(D)) == SomeOOInstance(ROOT)
+ assert unionof(SomeOOInstance(C1), SomeOOInstance(D)) == SomeOOInstance(ootype.ROOT)
def test_ooclass_array_contains():
A = ootype.Array(ootype.Signed)
diff --git a/rpython/rlib/test/test_rpoll.py b/rpython/rlib/test/test_rpoll.py
--- a/rpython/rlib/test/test_rpoll.py
+++ b/rpython/rlib/test/test_rpoll.py
@@ -1,4 +1,6 @@
-import thread, errno
+import os
+import errno
+
from rpython.rlib.rsocket import *
from rpython.rlib.rpoll import *
from rpython.rtyper.test.test_llinterp import interpret
More information about the pypy-commit
mailing list