Skip to content

Commit

Permalink
Fix datetime regression tests with tzinfo 2022b
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Aug 14, 2022
1 parent 88d0e6e commit 9ddc310
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
import zoneinfo


AMSTERDAM_1937_DATETIMES = (
b'["1937-01-01T12:00:27.000087+00:20"]', # tzinfo<2022b and an example in RFC 3339
b'["1937-01-01T12:00:27.000087+00:00"]', # tzinfo>=2022b
)

AMSTERDAM_1937_DATETIMES_WITH_Z = (
b'["1937-01-01T12:00:27.000087+00:20"]',
b'["1937-01-01T12:00:27.000087Z"]',
)


class TestDatetime:
def test_datetime_naive(self):
"""
Expand Down Expand Up @@ -474,7 +485,7 @@ def test_datetime_partial_second_pendulum_supported(self):
)
]
)
== b'["1937-01-01T12:00:27.000087+00:20"]'
in AMSTERDAM_1937_DATETIMES
)

@pytest.mark.skipif(
Expand Down Expand Up @@ -502,7 +513,7 @@ def test_datetime_partial_second_zoneinfo(self):
)
]
)
== b'["1937-01-01T12:00:27.000087+00:20"]'
in AMSTERDAM_1937_DATETIMES
)

@pytest.mark.skipif(pytz is None, reason="pytz optional")
Expand All @@ -527,7 +538,7 @@ def test_datetime_partial_second_pytz(self):
)
]
)
== b'["1937-01-01T12:00:27.000087+00:20"]'
in AMSTERDAM_1937_DATETIMES
)

def test_datetime_partial_second_dateutil(self):
Expand All @@ -544,7 +555,7 @@ def test_datetime_partial_second_dateutil(self):
)
]
)
== b'["1937-01-01T12:00:27.000087+00:20"]'
in AMSTERDAM_1937_DATETIMES
)

def test_datetime_microsecond_max(self):
Expand Down Expand Up @@ -661,7 +672,7 @@ def test_datetime_utc_z_with_tz(self):
],
option=orjson.OPT_UTC_Z,
)
== b'["1937-01-01T12:00:27.000087+00:20"]'
in AMSTERDAM_1937_DATETIMES_WITH_Z
)

@pytest.mark.skipif(pendulum is None, reason="pendulum install broken on win")
Expand Down

0 comments on commit 9ddc310

Please sign in to comment.