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

Method testCustomParserShortDaynames

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

parserClass · 0.90
GermanParserInfoClass · 0.85
parseMethod · 0.45

Tested by

no test coverage detected