[CMF-checkins] CVS: CMF - test_DateC.py:1.2 test_ListC.py:1.3 test_SIC.py:1.3 test_SSC.py:1.3 test_Topic.py:1.5

Jeffrey Shell jeffrey@digicool.com
Fri, 30 Mar 2001 12:13:25 -0500 (EST)


Update of /cvs-repository/CMF/CMFTopic/tests
In directory korak:/home/jeffrey/InstanceHomes/cmf-dev/CMF/CMFTopic/tests

Modified Files:
	test_DateC.py test_ListC.py test_SIC.py test_SSC.py 
	test_Topic.py 
Log Message:
Minor restructuring of the test modules to be more uniform, and giving the test classes more readable names (helps when viewing output from test_AllTopic)


--- Updated File test_DateC.py in package CMF --
--- test_DateC.py	2001/03/30 16:51:41	1.1
+++ test_DateC.py	2001/03/30 17:13:22	1.2
@@ -4,7 +4,7 @@
 
 FriendlyDate = Products.CMFTopic.DateCriteria.FriendlyDateCriterion
 
-class FriendlyDateTest(unittest.TestCase):
+class TestFriendlyDate(unittest.TestCase):
     lessThanFiveDaysOld = {
         'value': 4,
         'operation': 'min',
@@ -91,8 +91,10 @@
         assert result[1][1] == 'range:max'
 
 def test_suite():
-    return unittest.makeSuite(FriendlyDateTest)
+    return unittest.makeSuite(TestFriendlyDate)
 
-if __name__ == '__main__':
+def main():
     unittest.TextTestRunner().run(test_suite())
     
+if __name__ == '__main__':
+    main()

--- Updated File test_ListC.py in package CMF --
--- test_ListC.py	2001/03/06 15:16:11	1.2
+++ test_ListC.py	2001/03/30 17:13:22	1.3
@@ -4,14 +4,7 @@
 LISTC = Products.CMFTopic.ListCriterion.ListCriterion
 
 
-class TestCase( unittest.TestCase ):
-    """
-    """
-    def setUp( self ):
-        pass
-
-    def tearDown( self ):
-        pass
+class TestListCriterion(unittest.TestCase):
     
     def test_Empty( self ):
         listc = LISTC('foo', 'foofield')
@@ -37,7 +30,10 @@
         assert items[0][1] == tuple( abc )
 
 def test_suite():
-    return unittest.makeSuite( TestCase )
+    return unittest.makeSuite(TestListCriterion)
+
+def main():
+    unittest.TextTestRunner().run(test_suite())
 
 if __name__ == '__main__':
-    unittest.TextTestRunner().run( test_suite() )
+    main()

--- Updated File test_SIC.py in package CMF --
--- test_SIC.py	2001/03/06 15:16:12	1.2
+++ test_SIC.py	2001/03/30 17:13:22	1.3
@@ -4,23 +4,16 @@
 SIC = Products.CMFTopic.SimpleIntCriterion.SimpleIntCriterion
 
 
-class TestCase( unittest.TestCase ):
-    """
-    """
-    def setUp( self ):
-        pass
+class TestSimpleInt(unittest.TestCase):
 
-    def tearDown( self ):
-        pass
-    
-    def test_Empty( self ):
+    def test_Empty(self):
         sic = SIC('foo', 'foofield' )
         assert sic.id == 'foo'
         assert sic.field == 'foofield'
         assert sic.value == None
-        assert len( sic.getCriteriaItems() ) == 0
+        assert len(sic.getCriteriaItems()) == 0
     
-    def test_Nonempty( self ):
+    def test_Nonempty(self):
         sic = SIC('foo', 'foofield')
         sic.edit('0')
         assert sic.id == 'foo'
@@ -40,26 +33,31 @@
         assert len(items[0]) == 2
         assert items[0][1] == 32
 
-    def test_Range( self ):
+    def test_Range(self):
         sic = SIC('foo', 'foofield')
         sic.edit(32, SIC.MINIMUM)
         items = sic.getCriteriaItems()
-        assert len( items ) == 2
-        assert len( items[0] ) == len( items[1] ) == 2
+        assert len(items) == 2
+        assert len(items[0]) == len(items[1]) == 2
         assert items[0][1] == 32
         assert items[1][0] == 'foofield_usage'
         assert items[1][1] == 'range:min'
+
         sic.direction = SIC.MAXIMUM
         items = sic.getCriteriaItems()
         assert items[1][0] == 'foofield_usage'
         assert items[1][1] == 'range:max'
+
         sic.direction = SIC.MINMAX
         items = sic.getCriteriaItems()
         assert items[1][0] == 'foofield_usage'
         assert items[1][1] == 'range:min:max'
 
 def test_suite():
-    return unittest.makeSuite( TestCase )
+    return unittest.makeSuite(TestSimpleInt)
+
+def main():
+    unittest.TextTestRunner().run(test_suite())
 
 if __name__ == '__main__':
-    unittest.TextTestRunner().run( test_suite() )
+    main()

--- Updated File test_SSC.py in package CMF --
--- test_SSC.py	2001/03/06 15:16:12	1.2
+++ test_SSC.py	2001/03/30 17:13:22	1.3
@@ -4,14 +4,7 @@
 SSC = Products.CMFTopic.SimpleStringCriterion.SimpleStringCriterion
 
 
-class TestCase( unittest.TestCase ):
-    """
-    """
-    def setUp( self ):
-        pass
-
-    def tearDown( self ):
-        pass
+class TestSimpleString(unittest.TestCase):
     
     def test_Empty( self ):
         ssc = SSC('foo', 'foofield')
@@ -26,14 +19,19 @@
         assert ssc.id == 'foo'
         assert ssc.field == 'foofield'
         assert ssc.value == 'bar'
+
         items =ssc.getCriteriaItems()
-        assert len( items ) == 1
-        assert len( items[0] ) == 2
+        assert len(items) == 1
+        assert len(items[0]) == 2
         assert items[0][0] == 'foofield'
         assert items[0][1] == 'bar'
 
 def test_suite():
-    return unittest.makeSuite( TestCase )
+    return unittest.makeSuite(TestSimpleString)
 
+def main():
+    unittest.TextTestRunner().run(test_suite())
+
 if __name__ == '__main__':
-    unittest.TextTestRunner().run( test_suite() )
+    main()
+    

--- Updated File test_Topic.py in package CMF --
--- test_Topic.py	2001/03/30 16:49:39	1.4
+++ test_Topic.py	2001/03/30 17:13:22	1.5
@@ -8,7 +8,7 @@
 Topic = Products.CMFTopic.Topic.Topic
 
 
-class TestCase( unittest.TestCase ):
+class TestTopic(unittest.TestCase):
     """ Test all the general Topic cases  """
     def test_Empty( self ):
         topic = Topic('top')
@@ -83,7 +83,7 @@
         
     
 def test_suite():
-    return unittest.makeSuite(TestCase)
+    return unittest.makeSuite(TestTopic)
 
 if __name__ == '__main__':
     unittest.TextTestRunner().run(test_suite())