[Zodb-checkins] CVS: Zope3/src/zope/interface/tests - test_advice.py:1.4

Steve Alexander steve at cat-box.net
Wed Jun 4 10:58:43 EDT 2003


Update of /cvs-repository/Zope3/src/zope/interface/tests
In directory cvs.zope.org:/tmp/cvs-serv11578/src/zope/interface/tests

Modified Files:
	test_advice.py 
Log Message:
Fixed test that was failing under Python 2.3 by explicitly using a
classic class instead of assuming that the TestCase is a classic class.


=== Zope3/src/zope/interface/tests/test_advice.py 1.3 => 1.4 ===
--- Zope3/src/zope/interface/tests/test_advice.py:1.3	Wed Jun  4 09:23:06 2003
+++ Zope3/src/zope/interface/tests/test_advice.py	Wed Jun  4 09:58:43 2003
@@ -30,6 +30,7 @@
 
 from unittest import TestCase, makeSuite, TestSuite
 from zope.interface.advice import *
+from types import ClassType
 import sys
 
 def ping(log, value):
@@ -40,6 +41,13 @@
 
     addClassAdvisor(pong)
 
+class ClassicClass:
+    __metaclass__ = ClassType
+    classLevelFrameInfo = getFrameInfo(sys._getframe())
+
+class NewStyleClass:
+    __metaclass__ = type
+    classLevelFrameInfo = getFrameInfo(sys._getframe())
 
 moduleLevelFrameInfo = getFrameInfo(sys._getframe())
 
@@ -48,17 +56,23 @@
     classLevelFrameInfo = getFrameInfo(sys._getframe())
 
     def checkModuleInfo(self):
-        kind,module,f_locals,f_globals = moduleLevelFrameInfo
-        self.assert_(kind=="module")
+        kind, module, f_locals, f_globals = moduleLevelFrameInfo
+        self.assertEquals(kind, "module")
         for d in module.__dict__, f_locals, f_globals:
             self.assert_(d is globals())
 
-    def checkClassInfo(self):
-        kind,module,f_locals,f_globals = self.classLevelFrameInfo
+    def checkClassicClassInfo(self):
+        kind, module, f_locals, f_globals = ClassicClass.classLevelFrameInfo
+        self.assertEquals(kind, "class")
+
+        self.assert_(f_locals is ClassicClass.__dict__)  # ???
+        for d in module.__dict__, f_globals:
+            self.assert_(d is globals())
+
+    def checkNewStyleClassInfo(self):
+        kind, module, f_locals, f_globals = NewStyleClass.classLevelFrameInfo
         self.assertEquals(kind, "class")
 
-        # Next assert fails on Python2.3
-        #assert f_locals is self.__class__.__dict__  # ???
         for d in module.__dict__, f_globals:
             self.assert_(d is globals())
 




More information about the Zodb-checkins mailing list