[pypy-svn] pypy default: Improve the test: "del a.x" should raise AttributeError if x
arigo
commits-noreply at bitbucket.org
Sat Jan 29 19:41:55 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r41457:1b0b88c259e1
Date: 2011-01-29 19:39 +0100
http://bitbucket.org/pypy/pypy/changeset/1b0b88c259e1/
Log: Improve the test: "del a.x" should raise AttributeError if x is a
slot that hasn't been assigned so far.
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
@@ -609,20 +609,24 @@
__slots__ = ('x',)
a = A()
raises(AttributeError, getattr, a, 'x')
+ raises(AttributeError, delattr, a, 'x')
a.x = 1
assert a.x == 1
assert A.__dict__['x'].__get__(a) == 1
del a.x
raises(AttributeError, getattr, a, 'x')
+ raises(AttributeError, delattr, a, 'x')
class B(A):
pass
b = B()
raises(AttributeError, getattr, b, 'x')
+ raises(AttributeError, delattr, b, 'x')
b.x = 1
assert b.x == 1
assert A.__dict__['x'].__get__(b) == 1
del b.x
raises(AttributeError, getattr, b, 'x')
+ raises(AttributeError, delattr, b, 'x')
class Z(object):
pass
z = Z()
More information about the Pypy-commit
mailing list