MCPcopy Create free account
hub / github.com/dateutil/dateutil / testCustomParserShortDaynames

Method testCustomParserShortDaynames

tests/test_parser.py:626–643  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

624 assert dt == datetime(2007, 1, 1)
625
626 def testCustomParserShortDaynames(self):
627 # Horacio Hoyos discovered that day names shorter than 3 characters,
628 # for example two letter German day name abbreviations, don't work:
629 # https://github.com/dateutil/dateutil/issues/343
630 from dateutil.parser import parserinfo, parser
631
632 class GermanParserInfo(parserinfo):
633 WEEKDAYS = [("Mo", "Montag"),
634 ("Di", "Dienstag"),
635 ("Mi", "Mittwoch"),
636 ("Do", "Donnerstag"),
637 ("Fr", "Freitag"),
638 ("Sa", "Samstag"),
639 ("So", "Sonntag")]
640
641 myparser = parser(GermanParserInfo())
642 dt = myparser.parse("Sa 21. Jan 2017")
643 self.assertEqual(dt, datetime(2017, 1, 21))
644
645 def testNoYearFirstNoDayFirst(self):
646 dtstr = '090107'

Callers

nothing calls this directly

Calls 3

parserClass · 0.90
GermanParserInfoClass · 0.85
parseMethod · 0.45

Tested by

no test coverage detected