[pypy-svn] r7659 - in pypy/trunk/src/pypy/appspace: . test

lac at codespeak.net lac at codespeak.net
Wed Nov 24 17:07:05 CET 2004


Author: lac
Date: Wed Nov 24 17:07:04 2004
New Revision: 7659

Modified:
   pypy/trunk/src/pypy/appspace/_file.py
   pypy/trunk/src/pypy/appspace/test/test_file.py
Log:
I am now mystified.  I made a testRaises TypeError.  A TypeError gets raised.
But the test still claims to fail.  Now to go read unittest source, but if
anybody knows why this fails, drop me a note ...




Modified: pypy/trunk/src/pypy/appspace/_file.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/_file.py	(original)
+++ pypy/trunk/src/pypy/appspace/_file.py	Wed Nov 24 17:07:04 2004
@@ -71,5 +71,5 @@
     def __setattr__(self, attr, val):
         "Make some attributes readonly."
         if attr in ['mode', 'name', 'closed', 'encoding']:
-            raise TypeError('readonly attribute: %s' % attr)
+            raise TypeError, "readonly attribute:'%s'" % attr
         self.__dict__[attr] = val

Modified: pypy/trunk/src/pypy/appspace/test/test_file.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/test/test_file.py	(original)
+++ pypy/trunk/src/pypy/appspace/test/test_file.py	Wed Nov 24 17:07:04 2004
@@ -20,6 +20,8 @@
         self.assertEquals(f.mode, 'w')
         self.assertEquals(f.closed, False)
         self.assertEquals(f.encoding, None) # Fix when we find out what this is
+        self.assertRaises(TypeError, setattr(f, 'name', 42))
+        #I am totally confused.  This test fails, but a Type Error gets raised.
         
 def test_main():
     unittest.main()



More information about the Pypy-commit mailing list