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

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


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

Modified Files:
	test_advice.py 
Log Message:
Replaced uses of assert with self.assert_ or self.assertEquals


=== Zope3/src/zope/interface/tests/test_advice.py 1.2 => 1.3 ===
--- Zope3/src/zope/interface/tests/test_advice.py:1.2	Tue Jun  3 18:46:26 2003
+++ Zope3/src/zope/interface/tests/test_advice.py	Wed Jun  4 09:23:06 2003
@@ -49,24 +49,25 @@
 
     def checkModuleInfo(self):
         kind,module,f_locals,f_globals = moduleLevelFrameInfo
-        assert kind=="module"
+        self.assert_(kind=="module")
         for d in module.__dict__, f_locals, f_globals:
-            assert d is globals()
+            self.assert_(d is globals())
 
     def checkClassInfo(self):
         kind,module,f_locals,f_globals = self.classLevelFrameInfo
-        assert kind=="class"
-        assert f_locals is self.__class__.__dict__  # ???
-        for d in module.__dict__, f_globals:
-            assert d is globals()
+        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())
 
     def checkCallInfo(self):
-        kind,module,f_locals,f_globals = getFrameInfo(sys._getframe())
-        assert kind=="function call"
-        assert f_locals is locals() # ???
+        kind, module, f_locals, f_globals = getFrameInfo(sys._getframe())
+        self.assertEquals(kind, "function call")
+        self.assert_(f_locals is locals()) # ???
         for d in module.__dict__, f_globals:
-            assert d is globals()
+            self.assert_(d is globals())
 
 
 class AdviceTests(TestCase):
@@ -80,14 +81,10 @@
 
         # Strip the list nesting
         for i in 1,2,3:
-            assert isinstance(Foo,list)
+            self.assert_(isinstance(Foo, list))
             Foo, = Foo
 
-        assert log == [
-            (1, Foo),
-            (2, [Foo]),
-            (3, [[Foo]]),
-        ]
+        self.assertEquals(log, [(1, Foo), (2, [Foo]), (3, [[Foo]])])
 
     def XXXcheckOutside(self):
         # Disabled because the check does not work with doctest tests.
@@ -106,18 +103,19 @@
         class aType(type,type):
             ping([],1)
         aType, = aType
-        assert aType.__class__ is type
+        self.assert_(aType.__class__ is type)
 
     def checkSingleExplicitMeta(self):
 
-        class M(type): pass
+        class M(type):
+            pass
 
         class C(M):
             __metaclass__ = M
             ping([],1)
 
         C, = C
-        assert C.__class__ is M
+        self.assert_(C.__class__ is M)
 
 
     def checkMixedMetas(self):
@@ -142,9 +140,9 @@
             __metaclass__ = M3
             ping([],1)
 
-        assert isinstance(C,list)
+        self.assert_(isinstance(C,list))
         C, = C
-        assert isinstance(C,M3)
+        self.assert_(isinstance(C,M3))
 
     def checkMetaOfClass(self):
 
@@ -154,7 +152,7 @@
         class meta(type):
             __metaclass__ = metameta
 
-        assert determineMetaclass((meta,type)) == metameta
+        self.assertEquals(determineMetaclass((meta, type)), metameta)
 
 TestClasses = (AdviceTests, FrameInfoTest)
 




More information about the Zodb-checkins mailing list