bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
https://bugs.python.org/issue37915
Automerge-Triggered-By: @pablogsal
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index d0101c9..5800487 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -413,6 +413,11 @@
with self.assertRaises(ValueError):
timezone(delta)
+ def test_comparison_with_tzinfo(self):
+ # Constructing tzinfo objects directly should not be done by users
+ # and serves only to check the bug described in bpo-37915
+ self.assertNotEqual(timezone.utc, tzinfo())
+ self.assertNotEqual(timezone(timedelta(hours=1)), tzinfo())
#############################################################################
# Base class for testing a particular aspect of timedelta, time, date and