[Checkins] SVN: zope.event/trunk/src/zope/event/tests.py 100% test coverage, even without the doctest.

Tres Seaver tseaver at palladion.com
Fri Apr 16 17:19:23 EDT 2010


Log message for revision 111006:
  100% test coverage, even without the doctest.

Changed:
  U   zope.event/trunk/src/zope/event/tests.py

-=-
Modified: zope.event/trunk/src/zope/event/tests.py
===================================================================
--- zope.event/trunk/src/zope/event/tests.py	2010-04-16 20:28:34 UTC (rev 111005)
+++ zope.event/trunk/src/zope/event/tests.py	2010-04-16 21:19:22 UTC (rev 111006)
@@ -11,14 +11,40 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Test the event system
-
-$Id$
+""" Test the event system
 """
 import unittest
 import doctest
 
+class Test_notify(unittest.TestCase):
+
+    def setUp(self):
+        from zope.event import subscribers
+        self._old_subscribers = subscribers[:]
+        subscribers[:] = []
+
+    def tearDown(self):
+        from zope.event import subscribers
+        subscribers[:] = self._old_subscribers
+
+    def _callFUT(self, event):
+        from zope.event import notify
+        notify(event)
+
+    def test_empty(self):
+        event = object()
+        self._callFUT(event)
+
+    def test_not_empty(self):
+        from zope.event import subscribers
+        dummy = []
+        subscribers.append(dummy.append)
+        event = object()
+        self._callFUT(event)
+        self.assertEqual(dummy, [event])
+
 def test_suite():
     return unittest.TestSuite((
+        unittest.makeSuite(Test_notify),
         doctest.DocFileSuite('README.txt'),
         ))



More information about the checkins mailing list