Author: David Ripton <[email protected]>
Branch: 
Changeset: r51585:07e667cb75a4
Date: 2012-01-21 11:01 -0500
http://bitbucket.org/pypy/pypy/changeset/07e667cb75a4/

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

diff --git a/pypy/module/test_lib_pypy/test_datetime.py 
b/pypy/module/test_lib_pypy/test_datetime.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/test_lib_pypy/test_datetime.py
@@ -0,0 +1,17 @@
+"""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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to