Changeset 1165

Show
Ignore:
Timestamp:
07/28/08 12:03:43 (4 months ago)
Author:
pierregm
Message:

* tseries: work around the lack of 'finally' in Python 2.4
* tests: use the numpy.testing/ run_module_suite syntax

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/timeseries/scikits/timeseries/tests/test_dates.py

    r1151 r1165  
    1414 
    1515import numpy as np 
    16 from scipy.testing import * 
     16from numpy.testing import * 
    1717 
    1818from numpy import ma 
     
    970970#------------------------------------------------------------------------------ 
    971971if __name__ == "__main__": 
    972     nose.run(argv=['', __file__]) 
     972    run_module_suite() 
     973 
  • trunk/timeseries/scikits/timeseries/tests/test_extras.py

    r1044 r1165  
    1212 
    1313import numpy as np 
    14 from scipy.testing import * 
     14from numpy.testing import * 
    1515from numpy.ma import masked 
    1616from numpy.ma.testutils import assert_equal, assert_almost_equal 
     
    7878#------------------------------------------------------------------------------ 
    7979if __name__ == "__main__": 
    80     nose.run(argv=['', __file__]) 
     80    run_module_suite() 
     81 
  • trunk/timeseries/scikits/timeseries/tests/test_timeseries.py

    r1125 r1165  
    1313import numpy as np 
    1414from numpy import bool_, complex_, float_, int_, object_ 
    15 from scipy.testing import * 
     15from numpy.testing import * 
    1616 
    1717import numpy.ma as ma 
     
    332332            # 
    333333            test = series[:3] 
     334            assert(isinstance(test, TimeSeries)) 
    334335            test_series = test._series 
    335336            assert_equal(test_series._data, data[:3]._data) 
     
    10121013#------------------------------------------------------------------------------ 
    10131014if __name__ == "__main__": 
    1014     nose.run(argv=['', __file__]) 
     1015    run_module_suite() 
     1016 
  • trunk/timeseries/scikits/timeseries/tests/test_trecords.py

    r1044 r1165  
    1919from numpy.ma.mrecords import addfield 
    2020 
    21 from scipy.testing import * 
     21from numpy.testing import * 
    2222from numpy.ma.testutils import assert_equal, assert_array_equal, assert_equal_records 
    2323 
     
    239239#------------------------------------------------------------------------------ 
    240240if __name__ == "__main__": 
    241     nose.run(argv=['', __file__]) 
     241    run_module_suite() 
     242 
  • trunk/timeseries/scikits/timeseries/tseries.py

    r1150 r1165  
    515515            newseries = self.__getitem__(sindx) 
    516516        except IndexError: 
    517  
    518517            # We don't need to recheck the index: just raise an exception 
    519518            if not recheck: 
     519                self.__class__ = _class 
    520520                raise 
    521521            # Maybe the index is a list of Dates ? 
     
    530530                    exc_info = sys.exc_info() 
    531531                    msg = "Invalid index or date '%s'" % indx 
     532                    self.__class__ = _class 
    532533                    raise IndexError(msg), None, exc_info[2] 
    533534                else: 
    534535                    newseries = self.__getitem__(indx) 
    535536                    dindx = indx 
     537                self.__class__ = _class 
    536538            else: 
    537539                newseries = self.__getitem__(indx) 
    538540                dindx = indx 
    539         finally: 
    540             self.__class__ = _class 
    541  
     541                self.__class__ = _class 
     542        self.__class__ = _class 
    542543        # Don't find the date if it's not needed...... 
    543544        if np.isscalar(newseries) or (newseries is masked):