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

Method testFuzzyAMPMProblem

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

Source from the content-addressed store, hash-verified

509 ('http://biz.yahoo.com/ipo/p/', '.html')))
510
511 def testFuzzyAMPMProblem(self):
512 # Sometimes fuzzy parsing results in AM/PM flag being set without
513 # hours - if it's fuzzy it should ignore that.
514 s1 = "I have a meeting on March 1, 1974."
515 s2 = "On June 8th, 2020, I am going to be the first man on Mars"
516
517 # Also don't want any erroneous AM or PMs changing the parsed time
518 s3 = "Meet me at the AM/PM on Sunset at 3:00 AM on December 3rd, 2003"
519 s4 = "Meet me at 3:00AM on December 3rd, 2003 at the AM/PM on Sunset"
520
521 self.assertEqual(parse(s1, fuzzy=True), datetime(1974, 3, 1))
522 self.assertEqual(parse(s2, fuzzy=True), datetime(2020, 6, 8))
523 self.assertEqual(parse(s3, fuzzy=True), datetime(2003, 12, 3, 3))
524 self.assertEqual(parse(s4, fuzzy=True), datetime(2003, 12, 3, 3))
525
526 def testFuzzyIgnoreAMPM(self):
527 s1 = "Jan 29, 1945 14:45 AM I going to see you there?"

Callers

nothing calls this directly

Calls 1

parseFunction · 0.90

Tested by

no test coverage detected