[Zope-Checkins] CVS: Zope3/lib/python/Persistence/tests - testModule.py:1.2

Jeremy Hylton jeremy@zope.com
Fri, 21 Jun 2002 15:28:44 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/tests
In directory cvs.zope.org:/tmp/cvs-serv14649/tests

Modified Files:
	testModule.py 
Log Message:
Add support for in-place update of modules and functions.



=== Zope3/lib/python/Persistence/tests/testModule.py 1.1 => 1.2 ===
         pmtest.f(4)
 
+    def testUpdate(self):
+        self.importer.module_from_source("pmtest",
+                                         "def f(x): return x")
+        get_transaction().commit()
+        import pmtest
+        assert pmtest.f(3) == 3
+        copy = pmtest.f
+        self.importer.update_module("pmtest",
+                                    "def f(x): return x + 1")
+        get_transaction().commit()
+        assert pmtest.f(3) == 4
+        assert copy(3) == 4
+
 def test_suite():
     return unittest.makeSuite(TestModule)