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

Method testFuzzyAMPMProblem

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

Source from the content-addressed store, hash-verified

521 ('http://biz.yahoo.com/ipo/p/', '.html')))
522
523 def testFuzzyAMPMProblem(self):
524 # Sometimes fuzzy parsing results in AM/PM flag being set without
525 # hours - if it's fuzzy it should ignore that.
526 s1 = "I have a meeting on March 1, 1974."
527 s2 = "On June 8th, 2020, I am going to be the first man on Mars"
528
529 # Also don't want any erroneous AM or PMs changing the parsed time
530 s3 = "Meet me at the AM/PM on Sunset at 3:00 AM on December 3rd, 2003"
531 s4 = "Meet me at 3:00AM on December 3rd, 2003 at the AM/PM on Sunset"
532
533 self.assertEqual(parse(s1, fuzzy=True), datetime(1974, 3, 1))
534 self.assertEqual(parse(s2, fuzzy=True), datetime(2020, 6, 8))
535 self.assertEqual(parse(s3, fuzzy=True), datetime(2003, 12, 3, 3))
536 self.assertEqual(parse(s4, fuzzy=True), datetime(2003, 12, 3, 3))
537
538 def testFuzzyIgnoreAMPM(self):
539 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