[pypy-svn] r66712 - pypy/branch/pyjitpl5/pypy/lib/app_test

arigo at codespeak.net arigo at codespeak.net
Fri Jul 31 11:19:43 CEST 2009


Author: arigo
Date: Fri Jul 31 11:19:42 2009
New Revision: 66712

Modified:
   pypy/branch/pyjitpl5/pypy/lib/app_test/test_dbm_extra.py
Log:
Don't use the default empty string in setdefault().  In some
implementations of dbm in C, you cannot set keys to empty values: if you
do, the key appears to be set but getting the corresponding value gives
a KeyError (on CPython too!).


Modified: pypy/branch/pyjitpl5/pypy/lib/app_test/test_dbm_extra.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/lib/app_test/test_dbm_extra.py	(original)
+++ pypy/branch/pyjitpl5/pypy/lib/app_test/test_dbm_extra.py	Fri Jul 31 11:19:42 2009
@@ -27,6 +27,7 @@
     py.test.raises(TypeError, "d.setdefault(123, 'xyz')")
     py.test.raises(TypeError, "d.setdefault('xyz', 123)")
     py.test.raises(TypeError, "d.get(123)")
-    d.setdefault('xyz')
-    assert dict(d) == {'xyz': ''}
+    assert dict(d) == {}
+    d.setdefault('xyz', '123')
+    assert dict(d) == {'xyz': '123'}
     d.close()



More information about the Pypy-commit mailing list