[Zope3-checkins] CVS: Zope3/lib/python/Zope/Event/tests - testDirectives.py:1.6 testEventService.py:1.5 testLogger.py:1.5

Jim Fulton jim@zope.com
Sun, 1 Dec 2002 05:32:30 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Event/tests
In directory cvs.zope.org:/tmp/cvs-serv3545/lib/python/Zope/Event/tests

Modified Files:
	testDirectives.py testEventService.py testLogger.py 
Log Message:
Renamed publishEvent to publish

=== Zope3/lib/python/Zope/Event/tests/testDirectives.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/Event/tests/testDirectives.py:1.5	Fri Nov  8 13:53:36 2002
+++ Zope3/lib/python/Zope/Event/tests/testDirectives.py	Sun Dec  1 05:32:29 2002
@@ -23,7 +23,7 @@
 from Zope.Configuration.xmlconfig import xmlconfig
 
 from Zope.Exceptions import NotFoundError
-from Zope.Event import subscribe, unsubscribe, publishEvent
+from Zope.Event import subscribe, unsubscribe, publish
 from Zope.Event.ObjectEvent import ObjectAddedEvent
 from Zope.Event.ObjectEvent import ObjectRemovedEvent
 from Zope.Event.ObjectEvent import ObjectModifiedEvent
@@ -60,13 +60,13 @@
                    filter="Zope.Event.tests.subscriber.filter" />'''
             ))
 
-        publishEvent(None,ObjectAddedEvent(None, 'foo'))
+        publish(None,ObjectAddedEvent(None, 'foo'))
         self.assertEqual(subscriber.notified,1)
-        publishEvent(None,ObjectRemovedEvent(object(), 'foo'))
+        publish(None,ObjectRemovedEvent(object(), 'foo'))
         self.assertEqual(subscriber.notified,2)
-        publishEvent(None,ObjectModifiedEvent(None, 'foo'))
+        publish(None,ObjectModifiedEvent(None, 'foo'))
         self.assertEqual(subscriber.notified,2) # NB: no increase ;-)
-        publishEvent(None,DummyEvent())
+        publish(None,DummyEvent())
         self.assertEqual(subscriber.notified,4) # NB: increased by 2 ;-)
         
         unsubscribe(subscriber)


=== Zope3/lib/python/Zope/Event/tests/testEventService.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/Event/tests/testEventService.py:1.4	Thu Oct  3 16:53:22 2002
+++ Zope3/lib/python/Zope/Event/tests/testEventService.py	Sun Dec  1 05:32:29 2002
@@ -50,7 +50,7 @@
     def testSubscribe1(self):
         "Test subscribe method with one parameter"
         self.service.subscribe(self.subscriber)
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
         
     def testSubscribe2(self):
@@ -59,7 +59,7 @@
             self.subscriber,
             event_type=IObjectAddedEvent
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
 
     def testSubscribe3(self):
@@ -69,7 +69,7 @@
             event_type=IObjectAddedEvent,
             filter=DummyFilter()
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
 
     def testSubscribe4(self):
@@ -81,7 +81,7 @@
             event_type=IObjectAddedEvent,
             filter=DummyFilter(0)
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 0)
 
     def testSubscribe5(self):
@@ -93,25 +93,25 @@
             event_type=IObjectModifiedEvent,
             filter=DummyFilter()
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 0)
 
     def testSubscribe6(self):
         """Test subscribe method where the event type
         registered is a generalised interface of the
-        event passed to the 'publishEvent' method.
+        event passed to the 'publish' method.
         """
         self.service.subscribe(
             self.subscriber,
             event_type=IObjectEvent
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
 
     def testSubscribe7(self):
         """Test subscribe method where one of the
         event types registered is not interested in
-        the publishEvented event.
+        the published event.
         """
         self.service.subscribe(
             self.subscriber,
@@ -121,7 +121,7 @@
             self.subscriber,
             event_type=IObjectAddedEvent
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
 
     def testSubscribe8(self):
@@ -143,17 +143,17 @@
             event_type=IObjectAddedEvent,
             filter=DummyFilter(0)
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 2)
 
     def testUnsubscribe1(self):
         "Test unsubscribe method"
         subscriber = self.subscriber
         self.service.subscribe(subscriber)
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
         self.service.unsubscribe(subscriber)
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
 
     def testUnsubscribe2(self):
@@ -185,41 +185,41 @@
             subscriber2,
             event_type=IObjectAddedEvent
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 3)
         self.assertEqual(subscriber2.notified, 1)
-        self.service.publishEvent(event2)
+        self.service.publish(event2)
         self.assertEqual(self.subscriber.notified, 4)
         self.assertEqual(subscriber2.notified, 1)
         self.service.unsubscribe(self.subscriber, IObjectAddedEvent)
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 6)
         self.assertEqual(subscriber2.notified, 2)
         self.service.unsubscribe(self.subscriber, IEvent)
-        self.service.publishEvent(event2)
+        self.service.publish(event2)
         self.assertEqual(self.subscriber.notified, 6)
         self.assertEqual(subscriber2.notified, 2)
         self.assertRaises(NotFoundError, self.service.unsubscribe,
                           self.subscriber, IObjectAddedEvent)
         self.service.unsubscribe(self.subscriber, IObjectAddedEvent, filter)
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 6)
         self.assertEqual(subscriber2.notified, 3)
         self.service.unsubscribe(subscriber2, IObjectAddedEvent)
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 6)
         self.assertEqual(subscriber2.notified, 3)
 
-    def testpublishEvent1(self):
-        "Test publishEvent method"
+    def testpublish1(self):
+        "Test publish method"
         subscriber = self.subscriber
         self.service.subscribe(subscriber)
         self.assertEqual(self.subscriber.notified, 0)        
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 1)
 
-    def testpublishEvent2(self):
-        """Test publishEvent method where subscriber has been
+    def testpublish2(self):
+        """Test publish method where subscriber has been
         subscribed twice, with a more generalised
         version of the initially subscribed interface
         in the second subscription.
@@ -233,11 +233,11 @@
             self.subscriber,
             event_type=IObjectAddedEvent,
             )
-        self.service.publishEvent(self.event)
+        self.service.publish(self.event)
         self.assertEqual(self.subscriber.notified, 2) 
 
-    def testpublishEvent3(self):
-        """Test publishEvent method where subscriber has been
+    def testpublish3(self):
+        """Test publish method where subscriber has been
         to two interfaces and a single event implements both
         of those interfaces.
         """
@@ -250,11 +250,11 @@
             self.subscriber,
             event_type=IObjectAddedEvent
             )
-        self.service.publishEvent(DummyEvent())
+        self.service.publish(DummyEvent())
         self.assertEqual(self.subscriber.notified, 2)
 
-    def testpublishEvent4(self):
-        """Test publishEvent method to make sure that we don't
+    def testpublish4(self):
+        """Test publish method to make sure that we don't
         'leak registrations up' sez Jim.
         """
         subscriber = self.subscriber
@@ -266,7 +266,7 @@
             self.subscriber,
             event_type=IObjectAddedEvent
             )
-        self.service.publishEvent(ObjectEvent())
+        self.service.publish(ObjectEvent())
         self.assertEqual(self.subscriber.notified, 1)
     
     def testListSubscriptions1(self):


=== Zope3/lib/python/Zope/Event/tests/testLogger.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/Event/tests/testLogger.py:1.4	Thu Oct  3 16:53:22 2002
+++ Zope3/lib/python/Zope/Event/tests/testLogger.py	Sun Dec  1 05:32:29 2002
@@ -21,7 +21,7 @@
 from Zope.ComponentArchitecture.tests.PlacelessSetup import PlacelessSetup
 from Zope.ComponentArchitecture import getServiceManager, getService
 
-from Zope.Event import subscribe, unsubscribe, publishEvent
+from Zope.Event import subscribe, unsubscribe, publish
 from Zope.Event.ObjectEvent import ObjectAddedEvent
 from Zope.Event.Logger import Logger
 
@@ -55,7 +55,7 @@
         # register a logger
         subscribe(self.eventlogger)
         # send an event
-        publishEvent(None, ObjectAddedEvent(None, 'foo'))
+        publish(None, ObjectAddedEvent(None, 'foo'))
 
     def tearDown(self):
         unsubscribe(self.eventlogger)