Commit c972c757 authored by Chris McDonough's avatar Chris McDonough

Raise an OverflowError to be in parity with DateIndex.

parent 23beb872
......@@ -11,7 +11,7 @@
#
##############################################################################
"""$Id: DateRangeIndex.py,v 1.9 2003/11/04 14:53:28 chrism Exp $
"""$Id: DateRangeIndex.py,v 1.10 2003/11/04 22:04:09 chrism Exp $
"""
import os
......@@ -406,8 +406,8 @@ class DateRangeIndex(UnIndex):
if isinstance( value, DateTime ):
value = value.millis() / 1000 / 60 # flatten to minutes
result = int( value )
if isinstance(result, long): # this won't work
raise ValueError( '%s is not within the range of dates allowed'
if isinstance(result, long): # this won't work (Python 2.3)
raise OverflowError( '%s is not within the range of dates allowed'
'by a DateRangeIndex' % value)
return result
......
......@@ -113,7 +113,7 @@ class DRI_Tests( unittest.TestCase ):
assert work.getEntryForObject( result ) == match.datum()
def test_longdates( self ):
self.assertRaises(ValueError, self._badlong )
self.assertRaises(OverflowError, self._badlong )
def _badlong(self):
work = DateRangeIndex ('work', 'start', 'stop' )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment