[Zope-Checkins] SVN: Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py Remove bare asserts (better error messages).
Tres Seaver
tseaver at palladion.com
Tue Jul 21 12:33:49 EDT 2009
Log message for revision 102058:
Remove bare asserts (better error messages).
Changed:
U Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py
-=-
Modified: Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py
===================================================================
--- Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py 2009-07-21 14:54:13 UTC (rev 102057)
+++ Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py 2009-07-21 16:33:49 UTC (rev 102058)
@@ -96,18 +96,18 @@
empty = DateRangeIndex( 'empty' )
- assert empty.getEntryForObject( 1234 ) is None
+ self.failUnless(empty.getEntryForObject( 1234 ) is None)
empty.unindex_object( 1234 ) # shouldn't throw
- assert not empty.uniqueValues( 'foo' )
- assert not empty.uniqueValues( 'foo', 1 )
+ self.failIf(empty.uniqueValues( 'foo' ))
+ self.failIf(empty.uniqueValues( 'foo', 1 ))
- assert empty._apply_index( { 'zed' : 12345 } ) is None
+ self.failUnless(empty._apply_index( { 'zed' : 12345 } ) is None)
result, used = empty._apply_index( { 'empty' : 12345 } )
- assert not result
- assert used == ( None, None )
+ self.failIf(result)
+ self.assertEqual(used, ( None, None ))
def test_retrieval( self ):
@@ -117,21 +117,20 @@
work.index_object( i, dummies[i] )
for i in range( len( dummies ) ):
- assert work.getEntryForObject( i ) == dummies[i].datum()
+ self.assertEqual(work.getEntryForObject( i ), dummies[i].datum())
for value in range( -1, 15 ):
matches = matchingDummies( value )
results, used = work._apply_index( { 'work' : value } )
- assert used == ( 'start', 'stop' )
+ self.assertEqual(used, ( 'start', 'stop' ))
- assert len( matches ) == len( results ), ( '%s: %s == %s'
- % ( value, map( lambda x: x.name(), matches ), results ) )
+ self.assertEqual(len( matches ), len( results ))
matches.sort( lambda x, y: cmp( x.name(), y.name() ) )
for result, match in map( None, results, matches ):
- assert work.getEntryForObject( result ) == match.datum()
+ self.assertEqual(work.getEntryForObject(result), match.datum())
def test_longdates( self ):
self.assertRaises(OverflowError, self._badlong )
@@ -153,22 +152,22 @@
work = DateRangeIndex( 'work', 'start', 'stop' )
work.index_object(0, dummy)
- assert work.getEntryForObject(0) == (20790915, 20790990)
+ self.assertEqual(work.getEntryForObject(0), (20790915, 20790990))
results, used = work._apply_index( { 'work' : before } )
- assert len(results) == 0
+ self.assertEqual(len(results), 0)
results, used = work._apply_index( { 'work' : start } )
- assert len(results) == 1
+ self.assertEqual(len(results), 1)
results, used = work._apply_index( { 'work' : between } )
- assert len(results) == 1
+ self.assertEqual(len(results), 1)
results, used = work._apply_index( { 'work' : stop } )
- assert len(results) == 1
+ self.assertEqual(len(results), 1)
results, used = work._apply_index( { 'work' : after } )
- assert len(results) == 0
+ self.assertEqual(len(results), 0)
def test_suite():
More information about the Zope-Checkins
mailing list