[pypy-svn] r59548 - pypy/trunk/lib-python/modified-2.5.2/test
arigo at codespeak.net
arigo at codespeak.net
Thu Oct 30 12:51:12 CET 2008
Author: arigo
Date: Thu Oct 30 12:51:11 2008
New Revision: 59548
Modified:
pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py
Log:
Fix a test to not rely on whether 'del ValueError().__dict__'
is allowed or not.
Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py Thu Oct 30 12:51:11 2008
@@ -2932,6 +2932,16 @@
mod.__dict__["spam"] = "eggs"
# Exception's __dict__ can be replaced, but not deleted
+ # (at least not any more than regular exception's __dict__ can
+ # be deleted; on CPython it is not the case, whereas on PyPy they
+ # can, just like any other new-style instance's __dict__.)
+ def can_delete_dict(e):
+ try:
+ del e.__dict__
+ except (TypeError, AttributeError):
+ return False
+ else:
+ return True
class Exception1(Exception, Base):
pass
class Exception2(Base, Exception):
@@ -2940,13 +2950,7 @@
e = ExceptionType()
e.__dict__ = {"a": 1}
vereq(e.a, 1)
- try:
- del e.__dict__
- except (TypeError, AttributeError):
- pass
- else:
- raise TestFailed, "%s instance __dict__ can be deleted" % (
- ExceptionType,)
+ assert can_delete_dict(e) == can_delete_dict(ValueError())
def pickles():
More information about the Pypy-commit
mailing list