Changeset 1502
- Timestamp:
- 09/27/08 08:47:18 (2 months ago)
- Files:
-
- trunk/timeseries/scikits/timeseries/parser.py (modified) (4 diffs)
- trunk/timeseries/scikits/timeseries/tests/test_dates.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/timeseries/scikits/timeseries/parser.py
r767 r1502 104 104 _isotime = _hour + ':?' + _minute + ':?' + _second + '? *' + _zone + '?' 105 105 106 _yeardate = _year 106 107 _weekdate = _year + '-?(?:' + _week + '-?' + _day + '?)?' 107 108 _eurodate = _day + '\.' + _month + '\.' + _year_epoch + '?' … … 160 161 _altisodateRE = re.compile(_altisodate, re.I) 161 162 _usisodateRE = re.compile(_usisodate, re.I) 163 _yeardateRE = re.compile(_yeardate, re.I) 162 164 _eurodateRE = re.compile(_eurodate, re.I) 163 165 _usdateRE = re.compile(_usdate, re.I) … … 180 182 'iso', 'altiso', 181 183 'lit', 'altlit', 'eurlit', 182 ' unknown')184 'year', 'unknown') 183 185 184 186 # Available time parsers … … 389 391 match = None 390 392 continue 393 break 394 395 elif format == 'year': 396 # just a year specified 397 match = _yeardateRE.match(text) 398 if match is not None: 399 year = match.groups()[0] 400 if year: 401 if len(year) == 2: 402 # Y2K problem: 403 year = add_century(int(year)) 404 else: 405 year = int(year) 406 else: 407 defaultdate = now() 408 year = defaultdate.year 409 day = 1 410 month = 1 391 411 break 392 412 trunk/timeseries/scikits/timeseries/tests/test_dates.py
r1457 r1502 59 59 assert_equal(dates, 24073 + np.arange(12)) 60 60 print "finished test_fromstrings" 61 62 # quarterly date 63 assert_equal( 64 Date(freq='Q', string='2007-01'), 65 Date(freq='Q', year=2007, quarter=1)) 66 67 # just a year 68 assert_equal(Date(freq='A', string='2007'), Date(freq='A', year=2007)) 61 69 62 70
