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

Method testCustomParserInfo

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

Source from the content-addressed store, hash-verified

613 assert parse(dt.isoformat()) == dt
614
615 def testCustomParserInfo(self):
616 # Custom parser info wasn't working, as Michael Elsdörfer discovered.
617 from dateutil.parser import parserinfo, parser
618
619 class myparserinfo(parserinfo):
620 MONTHS = parserinfo.MONTHS[:]
621 MONTHS[0] = ("Foo", "Foo")
622 myparser = parser(myparserinfo())
623 dt = myparser.parse("01/Foo/2007")
624 assert dt == datetime(2007, 1, 1)
625
626 def testCustomParserShortDaynames(self):
627 # Horacio Hoyos discovered that day names shorter than 3 characters,

Callers

nothing calls this directly

Calls 3

parserClass · 0.90
myparserinfoClass · 0.85
parseMethod · 0.45

Tested by

no test coverage detected