[Zope3-checkins] CVS: Zope3/src/zope/component/tests - test_factory.py:1.4

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 9 19:58:45 EST 2004


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

Modified Files:
	test_factory.py 
Log Message:


Make sure that functions and other non-class objects can also be wrapped as a
factory.


=== Zope3/src/zope/component/tests/test_factory.py 1.3 => 1.4 ===
--- Zope3/src/zope/component/tests/test_factory.py:1.3	Tue Mar  9 10:27:32 2004
+++ Zope3/src/zope/component/tests/test_factory.py	Tue Mar  9 19:58:45 2004
@@ -40,12 +40,14 @@
 
     def setUp(self):
         self._factory = Factory(Klass, 'Klass', 'Klassier')
+        self._factory2 = Factory(lambda x: x, 'Func', 'Function')
 
     def testCall(self):
         kl = self._factory(3, foo=4)
         self.assert_(isinstance(kl, Klass))
         self.assertEqual(kl.args, (3, ))
         self.assertEqual(kl.kw, {'foo': 4})
+        self.assertEqual(self._factory2(3), 3)
 
     def testTitleDescription(self):
         self.assertEqual(self._factory.title, 'Klass')
@@ -54,7 +56,9 @@
     def testGetInterfaces(self):
         implemented = self._factory.getInterfaces()
         self.assert_(implemented.isOrExtends(IKlass))
-        self.assertEqual([iface for iface in implemented], [IKlass])
+        self.assertEqual(list(implemented), [IKlass])
+        implemented2 = self._factory2.getInterfaces()
+        self.assertEqual(list(implemented2), [])
         
     
 class TestFactoryZAPIFunctions(PlacelessSetup, unittest.TestCase):




More information about the Zope3-Checkins mailing list