Skip to content

Commit

Permalink
make doctest for tzinfo work with python 3.6
Browse files Browse the repository at this point in the history
Python did change the repr() since then and it was failing, relax the
test a little bit by using more ellipsis
  • Loading branch information
barbieri committed Dec 15, 2020
1 parent e1a24ad commit afbc9dc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sgqlc/types/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
>>> for field_name in obj: # doctest: +ELLIPSIS
... print(field_name, repr(obj[field_name]))
time1 datetime.time(12, 34, 56)
time2 datetime.time(12, 34, 56, tzinfo=...(days=-1, seconds=75600)))
time2 datetime.time(12, 34, 56, tzinfo=...(...-1, ...75600)))
date1 datetime.date(2018, 1, 2)
date2 datetime.date(2018, 1, 2)
datetime1 datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=....utc)
datetime2 datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=...seconds=75600)))
datetime2 datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=...75600)))
Pre-converted types are allowed:
Expand Down Expand Up @@ -101,17 +101,17 @@ class Time(Scalar):
>>> Time('12:34:56Z') # Z = GMT/UTC
datetime.time(12, 34, 56, tzinfo=datetime.timezone.utc)
>>> Time('12:34:56-05:30') # doctest: +ELLIPSIS
datetime.time(12, 34, 56, tzinfo=...(days=-1, seconds=70200)))
datetime.time(12, 34, 56, tzinfo=...(...-1, ...70200)))
>>> Time('12:34:56+05:30') # doctest: +ELLIPSIS
datetime.time(12, 34, 56, tzinfo=...(seconds=19800)))
datetime.time(12, 34, 56, tzinfo=...(...19800)))
>>> Time('123456') # compact form
datetime.time(12, 34, 56)
>>> Time('123456Z') # compact form, GMT/UTC
datetime.time(12, 34, 56, tzinfo=datetime.timezone.utc)
>>> Time('123456-0530') # doctest: +ELLIPSIS
datetime.time(12, 34, 56, tzinfo=...(days=-1, seconds=70200)))
datetime.time(12, 34, 56, tzinfo=...(...-1, ...70200)))
>>> Time('123456+0530') # doctest: +ELLIPSIS
datetime.time(12, 34, 56, tzinfo=...(seconds=19800)))
datetime.time(12, 34, 56, tzinfo=...(...19800)))
Pre-converted values are allowed:
Expand Down Expand Up @@ -230,17 +230,17 @@ class DateTime(Scalar):
>>> DateTime('2018-01-02T12:34:56Z') # Z = GMT/UTC
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=datetime.timezone.utc)
>>> DateTime('2018-01-02T12:34:56-05:30') # doctest: +ELLIPSIS
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=..., seconds=70200)))
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=..., ...70200)))
>>> DateTime('2018-01-02T12:34:56+05:30') # doctest: +ELLIPSIS
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=...(seconds=19800)))
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=...(...19800)))
>>> DateTime('20180102T123456') # compact form
datetime.datetime(2018, 1, 2, 12, 34, 56)
>>> DateTime('20180102T123456Z') # compact form, GMT/UTC
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=datetime.timezone.utc)
>>> DateTime('20180102T123456-0530') # doctest: +ELLIPSIS
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=..., seconds=70200)))
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=..., ...70200)))
>>> DateTime('20180102T123456+0530') # doctest: +ELLIPSIS
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=...(seconds=19800)))
datetime.datetime(2018, 1, 2, 12, 34, 56, tzinfo=...(...19800)))
Pre-converted values are allowed:
Expand Down

0 comments on commit afbc9dc

Please sign in to comment.