[pypy-commit] pypy issue2343: Some failing tests
arigo
pypy.commits at gmail.com
Wed Jul 13 13:01:29 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: issue2343
Changeset: r85680:17e4455c688a
Date: 2016-07-13 19:02 +0200
http://bitbucket.org/pypy/pypy/changeset/17e4455c688a/
Log: Some failing tests
diff --git a/pypy/module/__builtin__/test/test_abstractinst.py b/pypy/module/__builtin__/test/test_abstractinst.py
--- a/pypy/module/__builtin__/test/test_abstractinst.py
+++ b/pypy/module/__builtin__/test/test_abstractinst.py
@@ -216,3 +216,11 @@
c = C()
assert isinstance(c, C)
assert not called
+
+ def test_instancecheck_exception_not_eaten(self):
+ class M(object):
+ def __instancecheck__(self, obj):
+ raise TypeError("foobar")
+
+ e = raises(TypeError, isinstance, 42, M())
+ assert str(e.value) == "foobar"
diff --git a/pypy/objspace/std/test/test_typeobject.py b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -1091,6 +1091,16 @@
C() # the lookup of '__new__' succeeds in 'int',
# but the lookup of '__init__' fails
+ def test_instancecheck(self):
+ assert int.__instancecheck__(42) is True
+ assert int.__instancecheck__(42.0) is False
+ class Foo:
+ __class__ = int
+ assert int.__instancecheck__(Foo()) is False
+ class Bar(object):
+ __class__ = int
+ assert int.__instancecheck__(Bar()) is True
+
class AppTestWithMethodCacheCounter:
spaceconfig = {"objspace.std.withmethodcachecounter": True}
@@ -1290,5 +1300,3 @@
assert not self.compares_by_identity(X)
del X.__eq__
assert self.compares_by_identity(X)
-
-
More information about the pypy-commit
mailing list