[pypy-svn] r32795 - in pypy/branch/even-more-config/pypy/config: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Oct 1 20:14:48 CEST 2006


Author: cfbolz
Date: Sun Oct  1 20:14:46 2006
New Revision: 32795

Modified:
   pypy/branch/even-more-config/pypy/config/config.py
   pypy/branch/even-more-config/pypy/config/test/test_config.py
Log:
rather raise an AttributeError when trying to set a non-existing option


Modified: pypy/branch/even-more-config/pypy/config/config.py
==============================================================================
--- pypy/branch/even-more-config/pypy/config/config.py	(original)
+++ pypy/branch/even-more-config/pypy/config/config.py	Sun Oct  1 20:14:46 2006
@@ -42,7 +42,7 @@
 
     def setoption(self, name, value, who):
         if name not in self._cfgimpl_values:
-            raise ValueError('unknown option %s' % (name,))
+            raise AttributeError('unknown option %s' % (name,))
         child = getattr(self._cfgimpl_descr, name)
         oldowner = self._cfgimpl_value_owners[child._name]
         oldvalue = getattr(self, name)

Modified: pypy/branch/even-more-config/pypy/config/test/test_config.py
==============================================================================
--- pypy/branch/even-more-config/pypy/config/test/test_config.py	(original)
+++ pypy/branch/even-more-config/pypy/config/test/test_config.py	Sun Oct  1 20:14:46 2006
@@ -46,7 +46,7 @@
 
     py.test.raises(ValueError, 'config.objspace = "foo"')
     py.test.raises(ValueError, 'config.gc.name = "foo"')
-    py.test.raises(ValueError, 'config.gc.foo = "bar"')
+    py.test.raises(AttributeError, 'config.gc.foo = "bar"')
     py.test.raises(ValueError, 'config.bool = 123')
     py.test.raises(ValueError, 'config.int = "hello"')
     py.test.raises(ValueError, 'config.gc.float = None')



More information about the Pypy-commit mailing list