def test_regex_matching_month():
    t1 = "1999m4"
    t2 = "1999:m4"
    t3 = "1999:mIV"
    t4 = "1999mIV"
    result = datetime(1999, 4, 30)
    npt.assert_equal(date_parser(t1), result)
    npt.assert_equal(date_parser(t2), result)
    npt.assert_equal(date_parser(t3), result)
    npt.assert_equal(date_parser(t4), result)
def test_regex_matching_quarter():
    t1 = "1999q4"
    t2 = "1999:q4"
    t3 = "1999:qIV"
    t4 = "1999qIV"
    result = datetime(1999, 12, 31)
    npt.assert_equal(date_parser(t1), result)
    npt.assert_equal(date_parser(t2), result)
    npt.assert_equal(date_parser(t3), result)
    npt.assert_equal(date_parser(t4), result)
示例#3
0
 def _str_to_date(self, date):
     """
     Takes a string and returns a datetime object
     """
     if isinstance(self.data.dates, PeriodIndex):
         return Period(date)
     else:
         return datetools.date_parser(date)
示例#4
0
 def _str_to_date(self, date):
     """
     Takes a string and returns a datetime object
     """
     if isinstance(self.data.dates, PeriodIndex):
         return Period(date)
     else:
         return datetools.date_parser(date)
示例#5
0
 def _str_to_date(self, date):
     """
     Takes a string and returns a datetime object
     """
     return datetools.date_parser(date)
示例#6
0
 def _str_to_date(self, date):
     """
     Takes a string and returns a datetime object
     """
     return datetools.date_parser(date)