[Zope3-checkins] CVS: Zope3/src/zodb/code/tests - atestmodule.py:1.4 test_patch.py:1.4
Jeremy Hylton
jeremy@zope.com
Tue, 28 Jan 2003 14:24:16 -0500
Update of /cvs-repository/Zope3/src/zodb/code/tests
In directory cvs.zope.org:/tmp/cvs-serv14258/zodb/code/tests
Modified Files:
atestmodule.py test_patch.py
Log Message:
Fix patch so that it doesn't touch foreign objects.
If a persistent module imports an object from some other module, it
shouldn't be converted to a persistent object. Add tests for
functions, classes, and interfaces.
=== Zope3/src/zodb/code/tests/atestmodule.py 1.3 => 1.4 ===
--- Zope3/src/zodb/code/tests/atestmodule.py:1.3 Fri Jan 24 18:20:54 2003
+++ Zope3/src/zodb/code/tests/atestmodule.py Tue Jan 28 14:23:44 2003
@@ -1,5 +1,7 @@
"""A module used to test persistent module patching."""
+from zodb.utils import *
+
def aFunc():
def nestedFunc():
return aFunc
=== Zope3/src/zodb/code/tests/test_patch.py 1.3 => 1.4 ===
--- Zope3/src/zodb/code/tests/test_patch.py:1.3 Fri Jan 24 18:20:54 2003
+++ Zope3/src/zodb/code/tests/test_patch.py Tue Jan 28 14:23:44 2003
@@ -2,6 +2,7 @@
from zodb.code.tests import atestmodule
import unittest
+from types import FunctionType as function
class TestNameFinder(unittest.TestCase):
@@ -41,6 +42,13 @@
self.assert_(newdict["aFunc"] is newdict["foo"][0])
+ # The patch should not touch modules, functions, etc. that
+ # are imported from other modules.
+ import zodb.utils
+ for name in dir(zodb.utils):
+ obj = getattr(zodb.utils, name)
+ if isinstance(obj, type) or isinstance(obj, function):
+ self.assert_(obj is newdict[name])
def test_suite():
s = unittest.TestSuite()