Пример #1
0
 def test_parse_datetime_tz(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date('2010-02-03T12:34Z')
     self.assertEqual('second', date[0])
     self.assertEqual(
         datetime.datetime(2010, 02, 03, 12, 34, tzinfo=isodate.UTC),
         date[1])
Пример #2
0
 def test_parse_datetime_tz(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date('2010-02-03T12:34Z')
     self.assertEqual('second', date[0])
     self.assertEqual(
         datetime.datetime(2010, 02, 03, 12, 34, tzinfo=isodate.UTC),
         date[1]
     )
Пример #3
0
 def test_parse_date(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date('2010-02-03')
     self.assertEqual('day', date[0])
     self.assertEqual(
         datetime.datetime(2010, 02, 03, tzinfo=isodate.UTC),
         date[1]
     )
Пример #4
0
 def test_parse_date_year(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date('2010')
     self.assertEqual('year', date[0])
     self.assertEqual(
         datetime.datetime(2010, 01, 01, tzinfo=isodate.UTC),
         date[1]
     )
Пример #5
0
 def test_parse_datetime(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date("2010-02-03T12:34")
     self.assertEqual("second", date[0])
     self.assertEqual(
         datetime.datetime(2010, 0o2, 0o3, 12, 34, tzinfo=isodate.UTC),
         date[1]
     )
Пример #6
0
 def test_parse_date_month(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date("2010-02")
     self.assertEqual("month", date[0])
     self.assertEqual(
         datetime.datetime(2010, 0o2, 0o1, tzinfo=isodate.UTC),
         date[1]
     )
Пример #7
0
 def test_parse_date(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date("2010-02-03")
     self.assertEqual("day", date[0])
     self.assertEqual(
         datetime.datetime(2010, 02, 03, tzinfo=isodate.UTC),
         date[1]
     )
Пример #8
0
 def test_parse_date_month(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date("2010-02")
     self.assertEqual("month", date[0])
     self.assertEqual(
         datetime.datetime(2010, 02, 01, tzinfo=isodate.UTC),
         date[1]
     )
Пример #9
0
 def test_parse_date_year(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date
     date = _parse_date("2010")
     self.assertEqual("year", date[0])
     self.assertEqual(
         datetime.datetime(2010, 01, 01, tzinfo=isodate.UTC),
         date[1]
     )
Пример #10
0
 def test_format_tz(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date, _format_date
     dt = _parse_date('2010-02-03T12:34:00+01:00')
     self.assertEquals('2010-02-03T12:34:00+01:00', _format_date(dt[1]))
Пример #11
0
 def test_format_tz(self):
     from c2cgeoportal.lib.wmstparsing import _parse_date, _format_date
     dt = _parse_date("2010-02-03T12:34:00+01:00")
     self.assertEqual("2010-02-03T12:34:00+01:00", _format_date(dt[1]))