[pypy-commit] pypy py3.6: Use built-in UTC object in tzinfo test

pganssle pypy.commits at gmail.com
Sun Apr 14 10:00:25 EDT 2019


Author: Paul Ganssle <paul at ganssle.io>
Branch: py3.6
Changeset: r96488:8cb9d2e352b4
Date: 2019-04-12 16:35 -0400
http://bitbucket.org/pypy/pypy/changeset/8cb9d2e352b4/

Log:	Use built-in UTC object in tzinfo test

	In Python 3.6, there is a built-in UTC object, so there is no need
	to make a custom one for this test.

diff --git a/pypy/module/cpyext/test/test_datetime.py b/pypy/module/cpyext/test/test_datetime.py
--- a/pypy/module/cpyext/test/test_datetime.py
+++ b/pypy/module/cpyext/test/test_datetime.py
@@ -188,17 +188,7 @@
         assert module.new_datetime() == datetime.datetime(
             2000, 6, 6, 6, 6, 6, 6)
 
-        class UTC(datetime.tzinfo):
-            def utcoffset(self, dt):
-                return datetime.timedelta(hours=0)
-
-            def dst(self, dt):
-                return datetime.timedelta(0)
-
-            def tzname(self, dt):
-                return "UTC"
-
-        utc = UTC()
+        utc = datetime.timezone.utc
 
         # .fromtimestamp tests
         assert (module.new_datetime_fromtimestamp() ==


More information about the pypy-commit mailing list