Armin Rigo avatar Armin Rigo committed 1b0b88c

Improve the test: "del a.x" should raise AttributeError if x
is a slot that hasn't been assigned so far.

Comments (0)

Files changed (1)

pypy/objspace/std/test/test_typeobject.py

             __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()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.