[Zope3-checkins] CVS: Zope3/src/zope/app/tests - test_introspector.py:1.4
Albertas Agejevas
alga@codeworks.lt
Wed, 2 Jul 2003 07:02:18 -0400
Update of /cvs-repository/Zope3/src/zope/app/tests
In directory cvs.zope.org:/tmp/cvs-serv19248/src/zope/app/tests
Modified Files:
test_introspector.py
Log Message:
Updated the introspector to use the Interface service instead of ++module++.
Added a functional test.
=== Zope3/src/zope/app/tests/test_introspector.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/tests/test_introspector.py:1.3 Tue Jun 3 11:45:09 2003
+++ Zope3/src/zope/app/tests/test_introspector.py Wed Jul 2 07:02:18 2003
@@ -11,8 +11,18 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+"""
+
+Revision information:
+$Id$
+"""
+
+from unittest import TestCase, TestSuite, main, makeSuite
+from zope.testing.cleanup import CleanUp
+from zope.app.introspector import Introspector
from zope.interface import Interface, Attribute, implements
+
class ITestClass(Interface):
def drool():
"""...drool..."""
@@ -46,39 +56,31 @@
"""method two"""
-"""
-
-Revision information:
-$Id$
-"""
-
-from zope.interface import Interface
-from unittest import TestCase, TestSuite, main, makeSuite
-from zope.testing.cleanup import CleanUp
-from zope.app.introspector import Introspector
-
-
-
class Test(CleanUp, TestCase):
"""Test Introspector."""
- def testIntrospector(self):
- # Testing introspector
+ def test_isInterface(self):
ints = Introspector(ITestClass)
self.assertEqual(ints.isInterface(), 1)
ints = Introspector(TestClass())
self.assertEqual(ints.isInterface(), 0)
+
+ def test_getClass(self):
+ ints = Introspector(TestClass())
request = {}
ints.setRequest(request)
self.assertEqual(ints.getClass(), 'TestClass')
+ def testIntrospectorOnClass(self):
+ request = {}
ints = Introspector(TestClass)
self.assertEqual(ints.isInterface(), 0)
request['PATH_INFO'] = (
'++module++zope.app.tests.test_introspector.TestClass')
ints.setRequest(request)
self.assertEqual(ints.getClass(), 'TestClass')
+
self.assertEqual(
ints.getBaseClassNames(),
['zope.app.tests.test_introspector.BaseTestClass'])
@@ -92,6 +94,8 @@
['zope.app.tests.test_introspector.ITestClass'])
self.assertEqual(ints.getExtends(), (BaseTestClass,))
+ def testIntrospectorOnInterface(self):
+ request = {}
ints = Introspector(I3)
self.assertEqual(ints.isInterface(), 1)
request['PATH_INFO'] = (