Commit b0c7a9a5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

I'm not sure what the deal was with this test

parent b7ffa456
# expected: reffail
# Test some internals: when we execute some special functions, we often need to # Test some internals: when we execute some special functions, we often need to
# make sure to keep a reference to that function, in case that function ends up # make sure to keep a reference to that function, in case that function ends up
# unsetting itself. # unsetting itself.
...@@ -23,9 +22,9 @@ import sys ...@@ -23,9 +22,9 @@ import sys
def make_closure(f): def make_closure(f):
def inner(*args, **kw): def inner(*args, **kw):
print "starting", f.__name__ print "starting", getattr(f, '__name__', type(f).__name__)
r = f(*args, **kw) r = f(*args, **kw)
print "ending", f.__name__ print "ending", getattr(f, '__name__', type(f).__name__)
return r return r
return inner return inner
...@@ -122,7 +121,7 @@ def f(): ...@@ -122,7 +121,7 @@ def f():
@make_closure @make_closure
def __set__(self, obj, value, other_arg=2.0**10): def __set__(self, obj, value, other_arg=2.0**10):
print "D.__set__", obj, value print "D.__set__", type(obj), value
print other_arg print other_arg
del D.__set__ del D.__set__
print other_arg print other_arg
...@@ -159,7 +158,10 @@ def f(): ...@@ -159,7 +158,10 @@ def f():
C.x = D() C.x = D()
c = C() c = C()
print c.x print c.x
print c.x try:
print c.x
except Exception as e:
print e
f() f()
f() f()
f() f()
...@@ -177,7 +179,10 @@ def f(): ...@@ -177,7 +179,10 @@ def f():
class C(object): class C(object):
__contains__ = make_closure(D()) __contains__ = make_closure(D())
print 1 in C() try:
print 1 in C()
except Exception as e:
print e
f() f()
f() f()
f() f()
...@@ -190,7 +195,7 @@ def f(): ...@@ -190,7 +195,7 @@ def f():
print "D.__getattribute__" print "D.__getattribute__"
del C.__getattribute__ del C.__getattribute__
del D.__get__ del D.__get__
print self print type(self)
return lambda *args: 1 return lambda *args: 1
class C(object): class C(object):
...@@ -210,5 +215,7 @@ def f(): ...@@ -210,5 +215,7 @@ def f():
del globals()['f'] del globals()['f']
g() g()
f() f()
f() try:
f() f()
except Exception as e:
print type(e)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment