[CMF-checkins] CVS: CMF/CMFTopic/tests - test_DateC.py:1.10 test_ListC.py:1.9 test_SIC.py:1.8 test_SSC.py:1.8 test_SortC.py:1.4 test_Topic.py:1.10 test_all.py:1.6

Yvo Schubbe schubbe at web.de
Fri Jan 2 13:15:51 EST 2004


Update of /cvs-repository/CMF/CMFTopic/tests
In directory cvs.zope.org:/tmp/cvs-serv3045/CMFTopic/tests

Modified Files:
	test_DateC.py test_ListC.py test_SIC.py test_SSC.py 
	test_SortC.py test_Topic.py test_all.py 
Log Message:
- all CMFTopic and CMFCalendar tests can now be run by themselves (Collector #131)
- some whitespace and import cleanup


=== CMF/CMFTopic/tests/test_DateC.py 1.9 => 1.10 ===
--- CMF/CMFTopic/tests/test_DateC.py:1.9	Thu Aug  1 15:05:13 2002
+++ CMF/CMFTopic/tests/test_DateC.py	Fri Jan  2 13:15:50 2004
@@ -1,24 +1,34 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Unit tests for DateCriterion module.
 
 $Id$
 """
 
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
+
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
 from DateTime.DateTime import DateTime
 
-class FriendlyDateCriterionTests( unittest.TestCase ):
+
+class FriendlyDateCriterionTests(TestCase):
 
     lessThanFiveDaysOld = { 'value': 4
                           , 'operation': 'min'
@@ -76,7 +86,7 @@
 
         from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
         friendly = FriendlyDateCriterion( 'foo', 'foofield' )
-        
+
         friendly.apply( self.lessThanFiveDaysOld )
         self.assertEqual( friendly.value, 4 )
         self.assertEqual( friendly.operation, 'min' )
@@ -119,7 +129,7 @@
         self.assertEqual( friendly.daterange, 'ahead' )
 
         now = DateTime()
-        
+
         result = friendly.getCriteriaItems()
         self.assertEqual( len( result ), 2 )
         self.assertEqual( result[0][0], 'foofield' )
@@ -135,7 +145,7 @@
 
         friendly.apply( self.lessThanFiveDaysOld )
         self.assertEqual( friendly.daterange, 'old' )
-        
+
         result = friendly.getCriteriaItems()
         self.assertEqual( len( result ), 2 )
         self.assertEqual( result[0][0], 'foofield' )
@@ -155,11 +165,11 @@
         self.assertEqual( result[0][1].Date(), ( DateTime() + 30 ).Date() )
         self.assertEqual( result[1][1], 'range:max' )
 
+
 def test_suite():
-    return unittest.makeSuite( FriendlyDateCriterionTests )
+    return TestSuite((
+        makeSuite(FriendlyDateCriterionTests),
+        ))
 
-def main():
-    unittest.TextTestRunner().run( test_suite() )
-    
 if __name__ == '__main__':
-    main()
+    main(defaultTest='test_suite')


=== CMF/CMFTopic/tests/test_ListC.py 1.8 => 1.9 ===
--- CMF/CMFTopic/tests/test_ListC.py:1.8	Thu Aug  1 15:05:13 2002
+++ CMF/CMFTopic/tests/test_ListC.py	Fri Jan  2 13:15:50 2004
@@ -1,23 +1,32 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Unit tests for ListCriterion module.
 
 $Id$
 """
 
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class ListCriterionTests( unittest.TestCase ):
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
+
+class ListCriterionTests(TestCase):
 
     def test_Interface( self ):
         from Products.CMFTopic.interfaces import Criterion
@@ -34,7 +43,7 @@
         self.assertEqual( listc.field, 'foofield' )
         self.assertEqual( listc.value, ('',) )
         self.assertEqual( len(listc.getCriteriaItems()), 0 )
-    
+
     def test_Edit_withString( self ):
 
         from Products.CMFTopic.ListCriterion import ListCriterion
@@ -50,7 +59,7 @@
         self.assertEqual( len( items[0] ), 2 )
         self.assertEqual( items[0][0], 'foofield' )
         self.assertEqual( items[0][1], ( 'bar', 'baz' ) )
-    
+
     def test_Edit_withList( self ):
 
         from Products.CMFTopic.ListCriterion import ListCriterion
@@ -84,11 +93,11 @@
         self.assertEqual( len( items ), 2 )
         self.failUnless( ( 'foofield_operator', 'and' ) in items )
 
-def test_suite():
-    return unittest.makeSuite( ListCriterionTests )
 
-def main():
-    unittest.TextTestRunner().run( test_suite() )
+def test_suite():
+    return TestSuite((
+        makeSuite(ListCriterionTests),
+        ))
 
 if __name__ == '__main__':
-    main()
+    main(defaultTest='test_suite')


=== CMF/CMFTopic/tests/test_SIC.py 1.7 => 1.8 ===
--- CMF/CMFTopic/tests/test_SIC.py:1.7	Thu Aug  1 15:05:13 2002
+++ CMF/CMFTopic/tests/test_SIC.py	Fri Jan  2 13:15:50 2004
@@ -1,23 +1,32 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Unit tests for SimpleIntCriterion module.
 
 $Id$
 """
 
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class SimpleIntCriterionTests( unittest.TestCase ):
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
+
+class SimpleIntCriterionTests(TestCase):
 
     def test_Interface( self ):
         from Products.CMFTopic.interfaces import Criterion
@@ -35,7 +44,7 @@
         self.assertEqual( sic.value, None )
         self.assertEqual( sic.getValueString(), '' )
         self.assertEqual( len(sic.getCriteriaItems() ), 0 )
-    
+
     def test_EditWithString( self ):
 
         from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
@@ -50,7 +59,7 @@
         self.assertEqual( len( items[0] ), 2 )
         self.assertEqual( items[0][0], 'foofield' )
         self.assertEqual( items[0][1], 0 )
-    
+
     def test_EditWithInt( self ):
 
         from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
@@ -179,11 +188,11 @@
         self.assertEqual( items[1][0], 'foofield_usage' )
         self.assertEqual( items[1][1], 'range:min:max' )
 
-def test_suite():
-    return unittest.makeSuite( SimpleIntCriterionTests )
 
-def main():
-    unittest.TextTestRunner().run( test_suite() )
+def test_suite():
+    return TestSuite((
+        makeSuite(SimpleIntCriterionTests),
+        ))
 
 if __name__ == '__main__':
-    main()
+    main(defaultTest='test_suite')


=== CMF/CMFTopic/tests/test_SSC.py 1.7 => 1.8 ===
--- CMF/CMFTopic/tests/test_SSC.py:1.7	Thu Aug  1 15:05:13 2002
+++ CMF/CMFTopic/tests/test_SSC.py	Fri Jan  2 13:15:50 2004
@@ -1,23 +1,32 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Unit tests for SimpleStringCriterion module.
 
 $Id$
 """
 
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class SimpleStringCriterionTests( unittest.TestCase ):
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
+
+class SimpleStringCriterionTests(TestCase):
 
     def test_Interface( self ):
         from Products.CMFTopic.interfaces import Criterion
@@ -25,7 +34,7 @@
             import SimpleStringCriterion
         self.failUnless(
             Criterion.isImplementedByInstancesOf( SimpleStringCriterion ) )
-    
+
     def test_Empty( self ):
 
         from Products.CMFTopic.SimpleStringCriterion \
@@ -37,7 +46,7 @@
         self.assertEqual( ssc.field, 'foofield' )
         self.assertEqual( ssc.value, '' )
         self.assertEqual( len( ssc.getCriteriaItems() ), 0 )
-    
+
     def test_Nonempty( self ):
 
         from Products.CMFTopic.SimpleStringCriterion \
@@ -57,12 +66,11 @@
         self.assertEqual( items[0][0], 'foofield' )
         self.assertEqual( items[0][1], 'bar' )
 
-def test_suite():
-    return unittest.makeSuite( SimpleStringCriterionTests )
 
-def main():
-    unittest.TextTestRunner().run( test_suite() )
+def test_suite():
+    return TestSuite((
+        makeSuite(SimpleStringCriterionTests),
+        ))
 
 if __name__ == '__main__':
-    main()
-    
+    main(defaultTest='test_suite')


=== CMF/CMFTopic/tests/test_SortC.py 1.3 => 1.4 ===
--- CMF/CMFTopic/tests/test_SortC.py:1.3	Thu Aug  1 15:05:13 2002
+++ CMF/CMFTopic/tests/test_SortC.py	Fri Jan  2 13:15:50 2004
@@ -1,30 +1,39 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 """ Unit tests for SortCriterion module.
 
 $Id$
 """
 
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class SortCriterionTests( unittest.TestCase ):
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
+
+class SortCriterionTests(TestCase):
 
     def test_Interface( self ):
         from Products.CMFTopic.interfaces import Criterion
         from Products.CMFTopic.SortCriterion import SortCriterion
         self.failUnless(
             Criterion.isImplementedByInstancesOf( SortCriterion ) )
-    
+
     def test_Empty( self ):
 
         from Products.CMFTopic.SortCriterion import SortCriterion
@@ -40,7 +49,7 @@
         self.assertEqual( len( items ), 1 )
         self.assertEqual( items[0][0], 'sort_on' )
         self.assertEqual( items[0][1], 'foofield' )
-    
+
     def test_Nonempty( self ):
 
         from Products.CMFTopic.SortCriterion import SortCriterion
@@ -61,12 +70,11 @@
         self.assertEqual( items[1][0], 'sort_order' )
         self.assertEqual( items[1][1], 'reverse' )
 
-def test_suite():
-    return unittest.makeSuite( SortCriterionTests )
 
-def main():
-    unittest.TextTestRunner().run( test_suite() )
+def test_suite():
+    return TestSuite((
+        makeSuite(SortCriterionTests),
+        ))
 
 if __name__ == '__main__':
-    main()
-    
+    main(defaultTest='test_suite')


=== CMF/CMFTopic/tests/test_Topic.py 1.9 => 1.10 ===
--- CMF/CMFTopic/tests/test_Topic.py:1.9	Thu Dec 20 16:06:27 2001
+++ CMF/CMFTopic/tests/test_Topic.py	Fri Jan  2 13:15:50 2004
@@ -1,6 +1,15 @@
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class TestTopic(unittest.TestCase):
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
+
+class TestTopic(TestCase):
     """
         Test all the general Topic cases
     """
@@ -12,7 +21,7 @@
 
         query = topic.buildQuery()
         self.assertEqual( len( query ), 0 )
-    
+
     def test_Simple( self ):
 
         from Products.CMFTopic.Topic import Topic
@@ -31,7 +40,7 @@
         self.assertEqual( len( query ), 2 )
         self.assertEqual( query[ 'foo' ], 'bar' )
         self.assertEqual( query[ 'baz' ], 43 )
-    
+
     def test_Nested( self ):
 
         from Products.CMFTopic.Topic import Topic
@@ -56,8 +65,11 @@
         self.assertEqual( len( query ), 1 )
         self.assertEqual( query['baz'], 'bam' )
 
+
 def test_suite():
-    return unittest.makeSuite(TestTopic)
+    return TestSuite((
+        makeSuite(TestTopic),
+        ))
 
 if __name__ == '__main__':
-    unittest.TextTestRunner().run(test_suite())
+    main(defaultTest='test_suite')


=== CMF/CMFTopic/tests/test_all.py 1.5 => 1.6 ===
--- CMF/CMFTopic/tests/test_all.py:1.5	Fri Feb 15 14:45:34 2002
+++ CMF/CMFTopic/tests/test_all.py	Fri Jan  2 13:15:50 2004
@@ -1,15 +1,23 @@
-import Zope
 from unittest import main
+
+import Testing
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
 from Products.CMFCore.tests.base.utils import build_test_suite
 
 def test_suite():
-
     return build_test_suite('Products.CMFTopic.tests',[
-        'test_Topic',
         'test_DateC',
         'test_ListC',
         'test_SIC',
+        'test_SortC',
         'test_SSC',
+        'test_Topic',
         ])
 
 if __name__ == '__main__':




More information about the CMF-checkins mailing list