[pypy-svn] rev 510 - pypy/trunk/src/pypy/interpreter/test

alex at codespeak.net alex at codespeak.net
Tue May 27 12:03:56 CEST 2003


Author: alex
Date: Tue May 27 12:03:55 2003
New Revision: 510

Modified:
   pypy/trunk/src/pypy/interpreter/test/test_extmodule.py
Log:
added test for appdata



Modified: pypy/trunk/src/pypy/interpreter/test/test_extmodule.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/test/test_extmodule.py	(original)
+++ pypy/trunk/src/pypy/interpreter/test/test_extmodule.py	Tue May 27 12:03:55 2003
@@ -14,6 +14,12 @@
     def amethod(self): return 23
     amethod = extmodule.appmethod(amethod)
 
+class BM_with_appdata(extmodule.BuiltinModule):
+    __pythonname__ = 'bm_with_appdata'
+    somedata = 'twentythree'
+    somedata = extmodule.appdata(somedata)
+
+
 class TestBuiltinModule(testsupport.TestCase):
 
     def setUp(self):
@@ -49,6 +55,21 @@
         result = space.call(w_method, space.wrap(()), None)
         self.assertEqual(result, 23)
 
+    def test_appdata(self):
+        space = self.space
+        bm = BM_with_appdata(space)
+        w_bm = bm.wrap_me()
+        w_bmd = space.getattr(w_bm, space.wrap('__dict__'))
+        bmd = space.unwrap(w_bmd)
+        thedata = bmd.get('somedata')
+        self.assertNotEqual(thedata, None)
+        w_data = space.getitem(w_bmd, space.wrap('somedata'))
+        bmd['somedata'] = BM_with_appdata.somedata
+        self.assertEqual(bmd,
+            {'__doc__': BM_with_appdata.__doc__,
+            '__name__': BM_with_appdata.__pythonname__,
+            'somedata': BM_with_appdata.somedata} )
+        self.assertEqual(thedata, 'twentythree')
 
 if __name__ == '__main__':
     testsupport.main()


More information about the Pypy-commit mailing list