[CMF-checkins] CVS: CMF/CMFTopic/tests - test_DateC.py:1.11
test_SIC.py:1.9
Yvo Schubbe
y.2004_ at wcm-solutions.de
Thu Feb 19 10:59:07 EST 2004
Update of /cvs-repository/CMF/CMFTopic/tests
In directory cvs.zope.org:/tmp/cvs-serv29063/CMFTopic/tests
Modified Files:
test_DateC.py test_SIC.py
Log Message:
- replaced deprecated _usage parameters
=== CMF/CMFTopic/tests/test_DateC.py 1.10 => 1.11 ===
--- CMF/CMFTopic/tests/test_DateC.py:1.10 Fri Jan 2 13:15:50 2004
+++ CMF/CMFTopic/tests/test_DateC.py Thu Feb 19 10:59:05 2004
@@ -27,6 +27,8 @@
from DateTime.DateTime import DateTime
+from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
+
class FriendlyDateCriterionTests(TestCase):
@@ -46,13 +48,10 @@
def test_Interface( self ):
from Products.CMFTopic.interfaces import Criterion
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
self.failUnless(
Criterion.isImplementedByInstancesOf( FriendlyDateCriterion ) )
def test_Empty( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
self.assertEqual( friendly.getId(), 'foo' )
@@ -63,8 +62,6 @@
self.assertEqual( len( friendly.getCriteriaItems() ), 0 )
def test_ListOfDefaultDates( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
d = friendly.defaultDateOptions()
@@ -73,8 +70,6 @@
self.assertEqual( d[2][0], 2 )
def test_Clear( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
friendly.edit( value=None )
@@ -83,8 +78,6 @@
self.assertEqual( friendly.daterange, 'old' )
def test_Basic( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
friendly.apply( self.lessThanFiveDaysOld )
@@ -93,8 +86,6 @@
self.assertEqual( friendly.daterange, 'old' )
def test_BadInput( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
# Bogus value
@@ -107,8 +98,6 @@
self.assertRaises( ValueError, friendly.edit, 4, 'max', 'new' )
def test_StringAsValue( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
friendly.edit( '4' )
@@ -121,8 +110,6 @@
self.assertEqual( friendly.value, None )
def test_Today( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
friendly.apply( self.today )
@@ -131,39 +118,35 @@
now = DateTime()
result = friendly.getCriteriaItems()
- self.assertEqual( len( result ), 2 )
+ self.assertEqual( len(result), 1 )
self.assertEqual( result[0][0], 'foofield' )
- self.assertEqual( result[0][1], ( now.earliestTime()
- , now.latestTime() ) )
- self.assertEqual( result[1][0], 'foofield_usage' )
- self.assertEqual( result[1][1], 'range:min:max' )
+ self.assertEqual( result[0][1]['query'],
+ ( now.earliestTime(), now.latestTime() ) )
+ self.assertEqual( result[0][1]['range'], 'min:max' )
def test_FiveDaysOld( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
friendly.apply( self.lessThanFiveDaysOld )
self.assertEqual( friendly.daterange, 'old' )
result = friendly.getCriteriaItems()
- self.assertEqual( len( result ), 2 )
+ self.assertEqual( len(result), 1 )
self.assertEqual( result[0][0], 'foofield' )
- self.assertEqual( result[0][1].Date(), ( DateTime() - 4 ).Date() )
- self.assertEqual( result[1][0], 'foofield_usage' )
- self.assertEqual( result[1][1], 'range:min' )
+ self.assertEqual( result[0][1]['query'].Date(),
+ ( DateTime() - 4 ).Date() )
+ self.assertEqual( result[0][1]['range'], 'min' )
def test_OneMonthAhead( self ):
-
- from Products.CMFTopic.DateCriteria import FriendlyDateCriterion
friendly = FriendlyDateCriterion( 'foo', 'foofield' )
friendly.apply( self.lessThanOneMonthAhead )
self.assertEqual( friendly.daterange, 'ahead' )
result = friendly.getCriteriaItems()
- self.assertEqual( result[0][1].Date(), ( DateTime() + 30 ).Date() )
- self.assertEqual( result[1][1], 'range:max' )
+ self.assertEqual( result[0][1]['query'].Date(),
+ ( DateTime() + 30 ).Date() )
+ self.assertEqual( result[0][1]['range'], 'max' )
def test_suite():
=== CMF/CMFTopic/tests/test_SIC.py 1.8 => 1.9 ===
--- CMF/CMFTopic/tests/test_SIC.py:1.8 Fri Jan 2 13:15:50 2004
+++ CMF/CMFTopic/tests/test_SIC.py Thu Feb 19 10:59:05 2004
@@ -25,19 +25,17 @@
# for Zope versions before 2.6.1
pass
+from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
+
class SimpleIntCriterionTests(TestCase):
def test_Interface( self ):
from Products.CMFTopic.interfaces import Criterion
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
self.failUnless(
Criterion.isImplementedByInstancesOf( SimpleIntCriterion ) )
def test_Empty( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
self.assertEqual( sic.getId(), 'foo' )
self.assertEqual( sic.field, 'foofield' )
@@ -46,9 +44,6 @@
self.assertEqual( len(sic.getCriteriaItems() ), 0 )
def test_EditWithString( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion('foo', 'foofield')
sic.edit('0')
self.assertEqual( sic.value, 0 )
@@ -61,9 +56,6 @@
self.assertEqual( items[0][1], 0 )
def test_EditWithInt( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( 32 )
self.assertEqual( sic.value, 32 )
@@ -75,9 +67,6 @@
self.assertEqual( items[0][1], 32 )
def test_RangeMin( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( '32', SimpleIntCriterion.MINIMUM )
@@ -85,18 +74,13 @@
self.assertEqual( sic.getValueString(), '32' )
items = sic.getCriteriaItems()
- self.assertEqual( len( items ), 2 )
+ self.assertEqual( len(items), 1 )
self.assertEqual( len( items[0] ), 2 )
- self.assertEqual( len( items[1] ), 2 )
self.assertEqual( items[0][0], 'foofield' )
- self.assertEqual( items[0][1], 32 )
- self.assertEqual( items[1][0], 'foofield_usage' )
- self.assertEqual( items[1][1], 'range:min' )
+ self.assertEqual( items[0][1]['query'], 32 )
+ self.assertEqual( items[0][1]['range'], 'min' )
def test_RangeMin_withInt( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( 32, SimpleIntCriterion.MINIMUM )
@@ -104,18 +88,13 @@
self.assertEqual( sic.getValueString(), '32' )
items = sic.getCriteriaItems()
- self.assertEqual( len( items ), 2 )
+ self.assertEqual( len(items), 1 )
self.assertEqual( len( items[0] ), 2 )
- self.assertEqual( len( items[1] ), 2 )
self.assertEqual( items[0][0], 'foofield' )
- self.assertEqual( items[0][1], 32 )
- self.assertEqual( items[1][0], 'foofield_usage' )
- self.assertEqual( items[1][1], 'range:min' )
+ self.assertEqual( items[0][1]['query'], 32 )
+ self.assertEqual( items[0][1]['range'], 'min' )
def test_RangeMax( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( '32', SimpleIntCriterion.MAXIMUM )
@@ -123,18 +102,13 @@
self.assertEqual( sic.getValueString(), '32' )
items = sic.getCriteriaItems()
- self.assertEqual( len( items ), 2 )
+ self.assertEqual( len(items), 1 )
self.assertEqual( len( items[0] ), 2 )
- self.assertEqual( len( items[1] ), 2 )
self.assertEqual( items[0][0], 'foofield' )
- self.assertEqual( items[0][1], 32 )
- self.assertEqual( items[1][0], 'foofield_usage' )
- self.assertEqual( items[1][1], 'range:max' )
+ self.assertEqual( items[0][1]['query'], 32 )
+ self.assertEqual( items[0][1]['range'], 'max' )
def test_RangeMax_withInt( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( 32, SimpleIntCriterion.MAXIMUM )
@@ -142,18 +116,13 @@
self.assertEqual( sic.getValueString(), '32' )
items = sic.getCriteriaItems()
- self.assertEqual( len( items ), 2 )
+ self.assertEqual( len(items), 1 )
self.assertEqual( len( items[0] ), 2 )
- self.assertEqual( len( items[1] ), 2 )
self.assertEqual( items[0][0], 'foofield' )
- self.assertEqual( items[0][1], 32 )
- self.assertEqual( items[1][0], 'foofield_usage' )
- self.assertEqual( items[1][1], 'range:max' )
+ self.assertEqual( items[0][1]['query'], 32 )
+ self.assertEqual( items[0][1]['range'], 'max' )
def test_RangeMinMax( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( '32 34', SimpleIntCriterion.MINMAX )
@@ -161,18 +130,13 @@
self.assertEqual( sic.getValueString(), '32 34' )
items = sic.getCriteriaItems()
- self.assertEqual( len( items ), 2 )
+ self.assertEqual( len(items), 1 )
self.assertEqual( len( items[0] ), 2 )
- self.assertEqual( len( items[1] ), 2 )
self.assertEqual( items[0][0], 'foofield' )
- self.assertEqual( items[0][1], ( 32, 34 ) )
- self.assertEqual( items[1][0], 'foofield_usage' )
- self.assertEqual( items[1][1], 'range:min:max' )
+ self.assertEqual( items[0][1]['query'], ( 32, 34 ) )
+ self.assertEqual( items[0][1]['range'], 'min:max' )
def test_RangeMinMax_withTuple( self ):
-
- from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion
-
sic = SimpleIntCriterion( 'foo', 'foofield' )
sic.edit( ( 32, 34 ), SimpleIntCriterion.MINMAX )
@@ -180,13 +144,11 @@
self.assertEqual( sic.getValueString(), '32 34' )
items = sic.getCriteriaItems()
- self.assertEqual( len( items ), 2 )
+ self.assertEqual( len(items), 1 )
self.assertEqual( len( items[0] ), 2 )
- self.assertEqual( len( items[1] ), 2 )
self.assertEqual( items[0][0], 'foofield' )
- self.assertEqual( items[0][1], ( 32, 34 ) )
- self.assertEqual( items[1][0], 'foofield_usage' )
- self.assertEqual( items[1][1], 'range:min:max' )
+ self.assertEqual( items[0][1]['query'], ( 32, 34 ) )
+ self.assertEqual( items[0][1]['range'], 'min:max' )
def test_suite():
More information about the CMF-checkins
mailing list