Skip to content

Commit

Permalink
Merge pull request #120 from moreati/doctests
Browse files Browse the repository at this point in the history
Fix 93 of 116 failing doctests (out of 214 total doctests)
  • Loading branch information
jarondl committed Sep 6, 2015
2 parents 0935d20 + b84ada5 commit 87a8220
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 94 deletions.
12 changes: 8 additions & 4 deletions dateutil/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,16 @@ def parse(self, timestr, default=None, ignoretz=False, tzinfos=None,
offset from UTC in minutes or a :class:`tzinfo` object.
.. doctest::
:options: +NORMALIZE_WHITESPACE
>>> from dateutil.parser import parse
>>> from dateutil.tz import gettz
>>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")}
>>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos)
datetime.datetime(2014, 2, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800))
datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800))
>>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos)
datetime.datetime(2014, 2, 19, 17, 21, tzinfo=tzfile('America/Chicago'))
datetime.datetime(2012, 1, 19, 17, 21,
tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago'))
This parameter is ignored if ``ignoretz`` is set.
Expand Down Expand Up @@ -1146,14 +1148,16 @@ def parse(timestr, parserinfo=None, **kwargs):
offset from UTC in minutes or a :class:`tzinfo` object.
.. doctest::
:options: +NORMALIZE_WHITESPACE
>>> from dateutil.parser import parse
>>> from dateutil.tz import gettz
>>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")}
>>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos)
datetime.datetime(2014, 2, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800))
datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800))
>>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos)
datetime.datetime(2014, 2, 19, 17, 21, tzinfo=tzfile('America/Chicago'))
datetime.datetime(2012, 1, 19, 17, 21,
tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago'))
This parameter is ignored if ``ignoretz`` is set.
Expand Down

0 comments on commit 87a8220

Please sign in to comment.