[pypy-svn] r11875 - pypy/dist/pypy/interpreter/test

pedronis at codespeak.net pedronis at codespeak.net
Tue May 3 17:17:05 CEST 2005


Author: pedronis
Date: Tue May  3 17:17:05 2005
New Revision: 11875

Modified:
   pypy/dist/pypy/interpreter/test/test_py.py
Log:
test (for now failing) that traceback exceptions are normalized



Modified: pypy/dist/pypy/interpreter/test/test_py.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_py.py	(original)
+++ pypy/dist/pypy/interpreter/test/test_py.py	Tue May  3 17:17:05 2005
@@ -64,3 +64,28 @@
                                  (sys.executable, pypath, tmpfilepath) )
     assert output.splitlines()[-1] == str([tmpfilepath,'hello'])
     
+
+TB_NORMALIZATION_CHK= """
+class K(object):
+  def __repr__(self):
+     return "<normalized>"
+  def __str__(self):
+     return "-not normalized-"
+
+{}[K()]
+"""
+
+def test_tb_normalization():
+    tmpfilepath = str(udir.join("test_py_script.py"))
+    tmpfile = file( tmpfilepath, "w" )
+    tmpfile.write(TB_NORMALIZATION_CHK)
+    tmpfile.close()
+
+    e = None
+    try:
+        output = py.process.cmdexec( '''"%s" "%s" "%s" ''' %
+                                     (sys.executable, pypath, tmpfilepath) )
+    except py.process.cmdexec.Error, e:
+        pass
+    assert e," expected failure"
+    assert e.err.splitlines()[-1] == 'KeyError: <normalized>'



More information about the Pypy-commit mailing list