[pypy-svn] r74611 - in pypy/trunk/pypy/module/pyexpat: . test

afa at codespeak.net afa at codespeak.net
Thu May 20 23:30:58 CEST 2010


Author: afa
Date: Thu May 20 23:30:57 2010
New Revision: 74611

Added:
   pypy/trunk/pypy/module/pyexpat/test/test_parser.py   (contents, props changed)
Modified:
   pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py
Log:
It's now even possible to interpret the pyexpat module.
Start a test.


Modified: pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py
==============================================================================
--- pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py	(original)
+++ pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py	Thu May 20 23:30:57 2010
@@ -93,6 +93,9 @@
 class Storage:
     "Store objects under a non moving ID"
     def __init__(self):
+        self.clear()
+
+    def clear(self):
         self.next_id = 0
         self.storage = {}
 

Added: pypy/trunk/pypy/module/pyexpat/test/test_parser.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/module/pyexpat/test/test_parser.py	Thu May 20 23:30:57 2010
@@ -0,0 +1,17 @@
+from pypy.conftest import gettestobjspace
+from pypy.module.pyexpat.interp_pyexpat import global_storage
+
+class AppTestPyexpat:
+    def setup_class(cls):
+        cls.space = gettestobjspace(usemodules=['pyexpat'])
+
+    def teardown_class(cls):
+        global_storage.clear()
+
+    def test_simple(self):
+        import pyexpat
+        p = pyexpat.ParserCreate()
+        res = p.Parse("<xml></xml>")
+        assert res == 1
+
+        raises(pyexpat.ExpatError, p.Parse, "3")



More information about the Pypy-commit mailing list