Commits

David Ripton  committed 07e667c

Add a test to prove that datetime issue972 (and dupe issue986) are fixed.

  • Participants
  • Parent commits 235d8b8

Comments (0)

Files changed (1)

File pypy/module/test_lib_pypy/test_datetime.py

+"""Additional tests for datetime."""
+
+import time
+import datetime
+import os
+
+def test_utcfromtimestamp():
+    """Confirm that utcfromtimestamp and fromtimestamp give consistent results.
+
+    Based on danchr's test script in https://bugs.pypy.org/issue986
+    """
+    os.putenv("TZ", "GMT")
+    for unused in xrange(100):
+        now = time.time()
+        delta = (datetime.datetime.utcfromtimestamp(now) -
+                 datetime.datetime.fromtimestamp(now))
+        assert delta.days * 86400 + delta.seconds == 0