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

Method testCustomParserInfo

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

Source from the content-addressed store, hash-verified

616 assert parse(dt.isoformat()) == dt
617
618 def testCustomParserInfo(self):
619 # Custom parser info wasn't working, as Michael Elsdörfer discovered.
620 from dateutil.parser import parser, parserinfo
621
622 class myparserinfo(parserinfo):
623 MONTHS = parserinfo.MONTHS[:]
624 MONTHS[0] = ("Foo", "Foo")
625 myparser = parser(myparserinfo())
626 dt = myparser.parse("01/Foo/2007")
627 assert dt == datetime(2007, 1, 1)
628
629 def testCustomParserShortDaynames(self):
630 # 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