[Python-modules-commits] [python-udatetime] 02/04: Import python-udatetime_0.0.11.orig.tar.gz

Ilias Tsitsimpis iliastsi-guest at moszumanska.debian.org
Fri Nov 4 13:58:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

iliastsi-guest pushed a commit to branch master
in repository python-udatetime.

commit 8a281853c4f1247baf106baa3f040040e3c0aff9
Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
Date:   Fri Nov 4 15:34:03 2016 +0200

    Import python-udatetime_0.0.11.orig.tar.gz
---
 PKG-INFO                    |  2 +-
 src/rfc3339.c               |  3 +++
 test/test_udatetime.py      | 15 ++++++++++++++-
 udatetime.egg-info/PKG-INFO |  2 +-
 udatetime/_pure.py          |  2 +-
 version.txt                 |  2 +-
 6 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 38d2455..39c2bfd 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: udatetime
-Version: 0.0.9
+Version: 0.0.11
 Summary: Fast RFC3339 compliant date-time library
 Home-page: https://github.com/freach/udatetime
 Author: Simon Pirschel
diff --git a/src/rfc3339.c b/src/rfc3339.c
index 722cc4b..fe3263e 100644
--- a/src/rfc3339.c
+++ b/src/rfc3339.c
@@ -779,6 +779,9 @@ static PyObject *to_rfc3339_string(PyObject *self, PyObject *args) {
         if (Py_TYPE(datetime_obj->tzinfo) == &FixedOffset_type) {
             FixedOffset *tzinfo = (FixedOffset *)datetime_obj->tzinfo;
             offset = tzinfo->offset;
+        } else {
+            PyErr_SetString(PyExc_ValueError, "Only TZFixedOffset supported.");
+            return NULL;
         }
     }
 
diff --git a/test/test_udatetime.py b/test/test_udatetime.py
index 09d9605..6ffd400 100644
--- a/test/test_udatetime.py
+++ b/test/test_udatetime.py
@@ -1,5 +1,5 @@
 import unittest
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, tzinfo
 import udatetime
 
 
@@ -185,5 +185,18 @@ class Test(unittest.TestCase):
         udt = udatetime.fromtimestamp(t)
         self.assertEqual(udt.microsecond, dt.microsecond)
 
+    def test_raise_on_not_TZFixedOffset(self):
+        class TZInvalid(tzinfo):
+            def utcoffset(self, dt=None):
+                return timedelta(seconds=0)
+
+            def dst(self, dt=None):
+                return timedelta(seconds=0)
+
+        dt = datetime.now(TZInvalid())
+
+        with self.assertRaises(ValueError):
+            udatetime.to_string(dt)
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/udatetime.egg-info/PKG-INFO b/udatetime.egg-info/PKG-INFO
index 38d2455..39c2bfd 100644
--- a/udatetime.egg-info/PKG-INFO
+++ b/udatetime.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: udatetime
-Version: 0.0.9
+Version: 0.0.11
 Summary: Fast RFC3339 compliant date-time library
 Home-page: https://github.com/freach/udatetime
 Author: Simon Pirschel
diff --git a/udatetime/_pure.py b/udatetime/_pure.py
index 7c25d5e..0c38bad 100644
--- a/udatetime/_pure.py
+++ b/udatetime/_pure.py
@@ -33,7 +33,7 @@ def _timestamp_to_date_time(timestamp, tzinfo):
     frac = (t_full - timestamp) * 1e6
     us = int(floor(frac + 0.5) if frac >= 0.0 else ceil(frac - 0.5))
 
-    if us == 1000000:
+    if us == 1e6:
         timestamp += 1
         us = 0
 
diff --git a/version.txt b/version.txt
index c5d54ec..2cfabea 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.0.9
+0.0.11

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-udatetime.git



More information about the Python-modules-commits mailing list