[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/stateful/tests - test_definition.py:1.2 test_xmlimportexport.py:1.3

Steve Alexander steve@cat-box.net
Fri, 6 Jun 2003 15:29:39 -0400


Update of /cvs-repository/Zope3/src/zope/app/workflow/stateful/tests
In directory cvs.zope.org:/tmp/cvs-serv7875/src/zope/app/workflow/stateful/tests

Modified Files:
	test_definition.py test_xmlimportexport.py 
Log Message:
Changed old-style __implements__ to new-style implements()

Also, fixed up some incorrect formatting.


=== Zope3/src/zope/app/workflow/stateful/tests/test_definition.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/workflow/stateful/tests/test_definition.py:1.1	Thu May  8 13:27:20 2003
+++ Zope3/src/zope/app/workflow/stateful/tests/test_definition.py	Fri Jun  6 15:29:07 2003
@@ -18,7 +18,7 @@
 """
 import unittest
 
-from zope.interface import Interface
+from zope.interface import Interface, implements
 from zope.interface.verify import verifyClass
 from zope.schema import TextLine
 
@@ -30,14 +30,14 @@
     """A really dummy state"""
 
 class DummyState:
-    __implements__ = IDummyState
+    implements(IDummyState)
 
 
 class IDummyTransition(Interface):
     """A really dummy transition"""
 
 class DummyTransition:
-    __implements__ = IDummyTransition
+    implements(IDummyTransition)
 
 
 class IDummyDataSchema(Interface):


=== Zope3/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py:1.2	Wed May 21 16:27:42 2003
+++ Zope3/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py	Fri Jun  6 15:29:07 2003
@@ -15,7 +15,7 @@
 from StringIO import StringIO
 
 from zope.interface.verify import verifyClass
-from zope.interface.implements import implements
+from zope.interface import implements, classImplements
 
 from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.component.adapter import provideAdapter
@@ -42,8 +42,6 @@
      import XMLImportHandler, XMLExportHandler
 
 
-
-
 xml_text = """<?xml version="1.0"?>
 <workflow type="StatefulWorkflow" title="TestPD">
 
@@ -57,7 +55,6 @@
   </states>
 
   <transitions>
-     
       <transition sourceState="state2"
                   destinationState="INITIAL"
                   script="some.path.to.some.script"
@@ -65,16 +62,14 @@
                   triggerMode="Manual"
                   title="State2toINITIAL"
                   name="state2_initial"/>
-    
-     
+
       <transition sourceState="INITIAL"
                   destinationState="state1"
                   permission="zope.Public"
                   triggerMode="Automatic"
                   title="INITIALtoState1"
                   name="initial_state1"/>
-    
-     
+
       <transition sourceState="state1"
                   destinationState="state2"
                   condition="python: 1==1"
@@ -82,22 +77,20 @@
                   triggerMode="Manual"
                   title="State1toState2"
                   name="state1_state2"/>
-    
+
   </transitions>
-  
+
 </workflow>
 """
 
 
 class TestProcessDefinition(StatefulProcessDefinition):
-    __implements__ = IAttributeAnnotatable, IUseConfigurable, \
-                     StatefulProcessDefinition.__implements__
+    implements(IAttributeAnnotatable, IUseConfigurable)
 
 # need to patch this cause these classes are used directly
 # in the import/export classes
-implements(State, IAttributeAnnotatable)
-implements(Transition, IAttributeAnnotatable)
-
+classImplements(State, IAttributeAnnotatable)
+classImplements(Transition, IAttributeAnnotatable)
 
 
 class Test(PlacefulSetup, unittest.TestCase):
@@ -115,7 +108,7 @@
     def testImport(self):
         testpd = TestProcessDefinition()
         handler = XMLImportHandler()
-        
+
         self.assertEqual(handler.canImport(testpd, StringIO(xml_text)), True)
         self.assertEqual(handler.canImport(None, StringIO(xml_text)), False)
         self.assertEqual(
@@ -128,14 +121,14 @@
         self.assertEqual(testpd.getRelevantDataSchema(),
                          'Some.path.to.an.ISchemaClass')
         self.assertEqual(getAdapter(testpd, IZopeDublinCore).title, 'TestPD')
-        
+
         self.assertEqual(len(testpd.states), 3)
         self.assertEqual(len(testpd.transitions), 3)
 
         st = testpd.states['INITIAL']
         self.assert_(isinstance(st, State))
         self.assertEqual(getAdapter(st, IZopeDublinCore).title, 'initial')
-                           
+
         st = testpd.states['state1']
         self.assert_(isinstance(st, State))
         self.assertEqual(getAdapter(st, IZopeDublinCore).title, 'State1')
@@ -155,7 +148,7 @@
         self.assertEqual(tr.script, None)
         self.assertEqual(tr.permission, CheckerPublic)
         self.assertEqual(tr.triggerMode, 'Automatic')
-        
+
         tr = testpd.transitions['state1_state2']
         self.assert_(isinstance(tr, Transition))
         self.assertEqual(getAdapter(tr, IZopeDublinCore).title,
@@ -166,7 +159,7 @@
         self.assertEqual(tr.script, None)
         self.assertEqual(tr.permission, CheckerPublic)
         self.assertEqual(tr.triggerMode, 'Manual')
-        
+
         tr = testpd.transitions['state2_initial']
         self.assert_(isinstance(tr, Transition))
         self.assertEqual(getAdapter(tr, IZopeDublinCore).title,
@@ -181,9 +174,7 @@
     def testExport(self):
         # XXX TBD before Merge into HEAD !!!!
         pass
-        
 
-        
 
 def test_suite():
     loader=unittest.TestLoader()