8000 bpo-30155: Add macros to get tzinfo from datetime instances by ZackerySpytz · Pull Request #21633 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-30155: Add macros to get tzinfo from datetime instances #21633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use timezone.utc
Use assertIs().
  • Loading branch information
ZackerySpytz authored and pganssle committed Sep 23, 2020
commit 83db28daee75934b9050996e6317043fb3eff413
8 changes: 4 additions & 4 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -5992,7 +5992,7 @@ class DateTimeSubclass(datetime):
for klass in [datetime, DateTimeSubclass]:
for args in [(1993, 8, 26, 22, 12, 55, 99999),
(1993, 8, 26, 22, 12, 55, 99999,
FixedOffset(0, "UTC", -2))]:
timezone.utc)]:
d = klass(*args)
with self.subTest(cls=klass, date=args):
hour, minute, second, microsecond, tzinfo = \
Expand All @@ -6002,15 +6002,15 @@ class DateTimeSubclass(datetime):
self.assertEqual(minute, d.minute)
self.assertEqual(second, d.second)
self.assertEqual(microsecond, d.microsecond)
self.assertEqual(tzinfo, d.tzinfo)
self.assertIs(tzinfo, d.tzinfo)

def test_PyDateTime_TIME_GET(self):
class TimeSubclass(time):
pass

for klass in [time, TimeSubclass]:
for args in [(12, 30, 20, 10),
(12, 30, 20, 10, FixedOffset(0, "UTC", -2))]:
(12, 30, 20, 10, timezone.utc)]:
d = klass(*args)
with self.subTest(cls=klass, date=args):
hour, minute, second, microsecond, tzinfo = \
Expand All @@ -6020,7 +6020,7 @@ class TimeSubclass(time):
self.assertEqual(minute, d.minute)
self.assertEqual(second, d.second)
self.assertEqual(microsecond, d.microsecond)
self.assertEqual(tzinfo, d.tzinfo)
self.assertIs(tzinfo, d.tzinfo)

def test_timezones_offset_zero(self):
utc0, utc1, non_utc = _testcapi.get_timezones_offset_zero()
Expand Down
0