[conduit] Make TestCoreUtil pass



commit 629dfc049ee5b9e18d59f8543769a287fcbb5e26
Author: John Stowers <john stowers gmail com>
Date:   Thu Sep 9 23:16:32 2010 +1200

    Make TestCoreUtil pass

 conduit/utils/__init__.py         |    4 ++--
 test/python-tests/TestCoreUtil.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/conduit/utils/__init__.py b/conduit/utils/__init__.py
index 2374bb7..0067620 100644
--- a/conduit/utils/__init__.py
+++ b/conduit/utils/__init__.py
@@ -297,7 +297,7 @@ def datetime_from_timestamp(t):
         raise Exception("Timestamp must be a number")
 
     if t < 0:
-        raise Exception("Timestamps before 1970 are not valid")
+        raise Exception("Timestamps before 1970 are not valid (was %s)" % t)
 
     return datetime.datetime.fromtimestamp(long(t))
 
@@ -313,7 +313,7 @@ def datetime_get_timestamp(d):
 
     f = time.mktime(d.timetuple())
     if f < 0:
-        raise Exception("Timestamps before 1970 are not valid")
+        raise Exception("Timestamps before 1970 are not valid (was %s)" % f)
 
     return long(f)
 
diff --git a/test/python-tests/TestCoreUtil.py b/test/python-tests/TestCoreUtil.py
index b3cfffa..e17fc12 100644
--- a/test/python-tests/TestCoreUtil.py
+++ b/test/python-tests/TestCoreUtil.py
@@ -12,7 +12,7 @@ import sys
 
 if is_online():
     ts = Utils.get_http_resource_last_modified("http://files.conduit-project.org/Conduit-0.3.0-screencast-small.mpeg";)
-    ok("Got mtime (timestamp) of http resource", ts == 1178459256.0)
+    ok("Got mtime (timestamp) of http resource", ts == 1178419656.0)
 
     mimetype = Utils.get_http_resource_mimetype("http://files.conduit-project.org/Conduit-0.3.0-screencast-small.mpeg";)
     ok("Got mimetype of http resource", mimetype == 'video/mpeg')
@@ -68,7 +68,7 @@ ok("Cmd with wrong args", Utils.exec_command_and_return_result("ls","does-not-ex
 ok("Cmd that doesnt exist", Utils.exec_command_and_return_result("cmd-does-not-exist",".") == None)  
 
 ts = 0
-dt = datetime.datetime(1970, 1, 1, 1, 0)
+dt = Utils.datetime_from_timestamp(ts)
 ok("Datetime to unix timestamp", Utils.datetime_get_timestamp(dt) == ts)
 ok("Unix timestamp to datetime", Utils.datetime_from_timestamp(ts) == dt)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]