Hello community, here is the log from the commit of package python-aniso8601 for openSUSE:Factory checked in at 2019-09-26 20:42:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-aniso8601 (Old) and /work/SRC/openSUSE:Factory/.python-aniso8601.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-aniso8601" Thu Sep 26 20:42:24 2019 rev:6 rq:733338 version:8.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-aniso8601/python-aniso8601.changes 2019-06-13 23:02:31.547436227 +0200 +++ /work/SRC/openSUSE:Factory/.python-aniso8601.new.2352/python-aniso8601.changes 2019-09-26 20:42:30.838337298 +0200 @@ -1,0 +2,7 @@ +Thu Sep 26 07:52:13 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 8.0.0: + * Handle ',' character as a fractional separator, as required by 4.2.2.4, see PR 12 + * Fix semver usage for prelease version, as required by clause 9 + +------------------------------------------------------------------- Old: ---- aniso8601-7.0.0.tar.gz New: ---- aniso8601-8.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-aniso8601.spec ++++++ --- /var/tmp/diff_new_pack.20CSaO/_old 2019-09-26 20:42:31.866334551 +0200 +++ /var/tmp/diff_new_pack.20CSaO/_new 2019-09-26 20:42:31.870334541 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define modname aniso8601 Name: python-%{modname} -Version: 7.0.0 +Version: 8.0.0 Release: 0 Summary: A library for parsing ISO 8601 strings License: BSD-3-Clause @@ -50,7 +50,7 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} python -m unittest discover aniso8601/tests/ +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m unittest discover aniso8601/tests/ %files %{python_files} %license LICENSE ++++++ aniso8601-7.0.0.tar.gz -> aniso8601-8.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/PKG-INFO new/aniso8601-8.0.0/PKG-INFO --- old/aniso8601-7.0.0/PKG-INFO 2019-06-11 21:23:12.000000000 +0200 +++ new/aniso8601-8.0.0/PKG-INFO 2019-09-12 02:58:51.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: aniso8601 -Version: 7.0.0 +Version: 8.0.0 Summary: A library for parsing ISO 8601 strings. Home-page: https://bitbucket.org/nielsenb/aniso8601 Author: Brandon Nielsen @@ -144,6 +144,13 @@ >>> aniso8601.parse_time('23.75') datetime.time(23, 45) + The decimal fraction can be specified with a comma instead of a full-stop:: + + >>> aniso8601.parse_time('22:33,5') + datetime.time(22, 33, 30) + >>> aniso8601.parse_time('23,75') + datetime.time(23, 45) + Leap seconds are currently not supported and attempting to parse one raises a :code:`LeapSecondError`:: >>> aniso8601.parse_time('23:59:60') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/README.rst new/aniso8601-8.0.0/README.rst --- old/aniso8601-7.0.0/README.rst 2019-03-08 21:17:24.000000000 +0100 +++ new/aniso8601-8.0.0/README.rst 2019-09-12 02:53:18.000000000 +0200 @@ -133,6 +133,13 @@ >>> aniso8601.parse_time('23.75') datetime.time(23, 45) +The decimal fraction can be specified with a comma instead of a full-stop:: + + >>> aniso8601.parse_time('22:33,5') + datetime.time(22, 33, 30) + >>> aniso8601.parse_time('23,75') + datetime.time(23, 45) + Leap seconds are currently not supported and attempting to parse one raises a :code:`LeapSecondError`:: >>> aniso8601.parse_time('23:59:60') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/decimalfraction.py new/aniso8601-8.0.0/aniso8601/decimalfraction.py --- old/aniso8601-7.0.0/aniso8601/decimalfraction.py 1970-01-01 01:00:00.000000000 +0100 +++ new/aniso8601-8.0.0/aniso8601/decimalfraction.py 2019-09-12 02:53:18.000000000 +0200 @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2019, Brandon Nielsen +# All rights reserved. +# +# This software may be modified and distributed under the terms +# of the BSD license. See the LICENSE file for details. + +def find_separator(value): + """Returns the decimal separator index if found else -1.""" + return normalize(value).find('.') + +def normalize(value): + """Returns the string that the decimal separators are normalized.""" + return value.replace(',', '.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/duration.py new/aniso8601-8.0.0/aniso8601/duration.py --- old/aniso8601-7.0.0/aniso8601/duration.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.0.0/aniso8601/duration.py 2019-09-12 02:53:18.000000000 +0200 @@ -10,6 +10,7 @@ from aniso8601.builders import TupleBuilder from aniso8601.builders.python import PythonTimeBuilder from aniso8601.date import parse_date +from aniso8601.decimalfraction import find_separator, normalize from aniso8601.exceptions import ISOFormatError, NegativeDurationError from aniso8601.time import parse_time @@ -46,15 +47,18 @@ 'character.') #Make sure only the lowest order element has decimal precision - if durationstr.count('.') > 1: - raise ISOFormatError('ISO 8601 allows only lowest order element to ' + separator_index = find_separator(durationstr) + if separator_index != -1: + remaining = durationstr[separator_index + 1:] + if find_separator(remaining) != -1: + raise ISOFormatError('ISO 8601 allows only lowest order element to ' 'have a decimal fraction.') - elif durationstr.count('.') == 1: + #There should only ever be 1 letter after a decimal if there is more #then one, the string is invalid lettercount = 0 - for character in durationstr.split('.')[1]: + for character in remaining: if character.isalpha() is True: lettercount += 1 @@ -214,11 +218,7 @@ durationstartindex += 1 - if ',' in durationstr: - #Replace the comma with a 'full-stop' - durationstr = durationstr.replace(',', '.') - - return durationstr[durationstartindex:durationendindex] + return normalize(durationstr[durationstartindex:durationendindex]) def _has_any_component(durationstr, components): #Given a duration string, and a list of components, returns True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/tests/test_decimalfraction.py new/aniso8601-8.0.0/aniso8601/tests/test_decimalfraction.py --- old/aniso8601-7.0.0/aniso8601/tests/test_decimalfraction.py 1970-01-01 01:00:00.000000000 +0100 +++ new/aniso8601-8.0.0/aniso8601/tests/test_decimalfraction.py 2019-09-12 02:55:32.000000000 +0200 @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2019, Brandon Nielsen +# All rights reserved. +# +# This software may be modified and distributed under the terms +# of the BSD license. See the LICENSE file for details. + +import unittest + +from aniso8601.decimalfraction import find_separator, normalize + +class TestDecimalFractionFunctions(unittest.TestCase): + def test_find_separator(self): + self.assertEqual(find_separator(''), -1) + self.assertEqual(find_separator('1234'), -1) + self.assertEqual(find_separator('12.345'), 2) + self.assertEqual(find_separator('123,45'), 3) + + def test_normalize(self): + self.assertEqual(normalize(''), '') + self.assertEqual(normalize('12.34'), '12.34') + self.assertEqual(normalize('123,45'), '123.45') + self.assertEqual(normalize('123,45,67'), '123.45.67') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/tests/test_duration.py new/aniso8601-8.0.0/aniso8601/tests/test_duration.py --- old/aniso8601-7.0.0/aniso8601/tests/test_duration.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.0.0/aniso8601/tests/test_duration.py 2019-09-12 02:53:18.000000000 +0200 @@ -23,22 +23,22 @@ testtuples = (('P1Y2M3DT4H54M6S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6'}), - ('P1Y2M3DT4H54M6.5S', {'PnY': '1', 'PnM': '2', + ('P1Y2M3DT4H54M6,5S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), - ('P1Y2M3DT4H54M6,5S', {'PnY': '1', 'PnM': '2', + ('P1Y2M3DT4H54M6.5S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), ('P1Y2M3D', {'PnY': '1', 'PnM': '2', 'PnW': None, 'PnD': '3'}), - ('P1Y2M3.5D', {'PnY': '1', 'PnM': '2', - 'PnW': None, 'PnD': '3.5'}), ('P1Y2M3,5D', {'PnY': '1', 'PnM': '2', 'PnW': None, 'PnD': '3.5'}), - ('PT4H54M6.5S', {'PnY': None, 'PnM': None, 'PnD': None, - 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), + ('P1Y2M3.5D', {'PnY': '1', 'PnM': '2', + 'PnW': None, 'PnD': '3.5'}), ('PT4H54M6,5S', {'PnY': None, 'PnM': None, 'PnD': None, 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), + ('PT4H54M6.5S', {'PnY': None, 'PnM': None, 'PnD': None, + 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), ('PT0.0000001S', {'PnY': None, 'PnM': None, 'PnD': None, 'TnH': None, 'TnM': None, 'TnS': '0.0000001'}), @@ -47,28 +47,28 @@ 'TnS': '2.0000048'}), ('P1Y', {'PnY': '1', 'PnM': None, 'PnW': None, 'PnD': None}), - ('P1.5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, - 'PnD': None}), ('P1,5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, 'PnD': None}), + ('P1.5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, + 'PnD': None}), ('P1M', {'PnY': None, 'PnM': '1', 'PnW': None, 'PnD': None}), - ('P1.5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, - 'PnD':None}), ('P1,5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, 'PnD':None}), + ('P1.5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, + 'PnD':None}), ('P1W', {'PnY': None, 'PnM': None, 'PnW': '1', 'PnD': None}), - ('P1.5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', - 'PnD': None}), ('P1,5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', 'PnD': None}), + ('P1.5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', + 'PnD': None}), ('P1D', {'PnY': None, 'PnM': None, 'PnW': None, 'PnD': '1'}), - ('P1.5D', {'PnY': None, 'PnM': None, 'PnW': None, - 'PnD': '1.5'}), ('P1,5D', {'PnY': None, 'PnM': None, 'PnW': None, 'PnD': '1.5'}), + ('P1.5D', {'PnY': None, 'PnM': None, 'PnW': None, + 'PnD': '1.5'}), ('P0003-06-04T12:30:05', {'PnY': '0003', 'PnM': '06', 'PnD': '04', 'TnH': '12', 'TnM': '30', 'TnS': '05'}), @@ -177,45 +177,45 @@ testtuples = (('P1Y2M3DT4H54M6S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6'}), - ('P1Y2M3DT4H54M6.5S', {'PnY': '1', 'PnM': '2', + ('P1Y2M3DT4H54M6,5S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), - ('P1Y2M3DT4H54M6,5S', {'PnY': '1', 'PnM': '2', + ('P1Y2M3DT4H54M6.5S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), - ('PT4H54M6.5S', {'PnY': None, 'PnM': None, 'PnD': None, - 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), ('PT4H54M6,5S', {'PnY': None, 'PnM': None, 'PnD': None, 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), + ('PT4H54M6.5S', {'PnY': None, 'PnM': None, 'PnD': None, + 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), ('P1Y2M3D', {'PnY': '1', 'PnM': '2', 'PnW': None, 'PnD': '3'}), - ('P1Y2M3.5D', {'PnY': '1', 'PnM': '2', - 'PnW': None, 'PnD': '3.5'}), ('P1Y2M3,5D', {'PnY': '1', 'PnM': '2', 'PnW': None, 'PnD': '3.5'}), + ('P1Y2M3.5D', {'PnY': '1', 'PnM': '2', + 'PnW': None, 'PnD': '3.5'}), ('P1Y', {'PnY': '1', 'PnM': None, 'PnW': None, 'PnD': None}), - ('P1.5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, - 'PnD': None}), ('P1,5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, 'PnD': None}), + ('P1.5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, + 'PnD': None}), ('P1M', {'PnY': None, 'PnM': '1', 'PnW': None, 'PnD': None}), - ('P1.5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, - 'PnD':None}), ('P1,5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, 'PnD':None}), + ('P1.5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, + 'PnD':None}), ('P1W', {'PnY': None, 'PnM': None, 'PnW': '1', 'PnD': None}), - ('P1.5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', - 'PnD': None}), ('P1,5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', 'PnD': None}), + ('P1.5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', + 'PnD': None}), ('P1D', {'PnY': None, 'PnM': None, 'PnW': None, 'PnD': '1'}), - ('P1.5D', {'PnY': None, 'PnM': None, 'PnW': None, - 'PnD': '1.5'}), ('P1,5D', {'PnY': None, 'PnM': None, 'PnW': None, + 'PnD': '1.5'}), + ('P1.5D', {'PnY': None, 'PnM': None, 'PnW': None, 'PnD': '1.5'})) for testtuple in testtuples: @@ -293,33 +293,33 @@ def test_parse_duration_prescribed_notime(self): testtuples = (('P1Y2M3D', {'PnY': '1', 'PnM': '2', 'PnW': None, 'PnD': '3'}), - ('P1Y2M3.5D', {'PnY': '1', 'PnM': '2', - 'PnW': None, 'PnD': '3.5'}), ('P1Y2M3,5D', {'PnY': '1', 'PnM': '2', 'PnW': None, 'PnD': '3.5'}), + ('P1Y2M3.5D', {'PnY': '1', 'PnM': '2', + 'PnW': None, 'PnD': '3.5'}), ('P1Y', {'PnY': '1', 'PnM': None, 'PnW': None, 'PnD': None}), - ('P1.5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, - 'PnD': None}), ('P1,5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, 'PnD': None}), + ('P1.5Y', {'PnY': '1.5', 'PnM': None, 'PnW': None, + 'PnD': None}), ('P1M', {'PnY': None, 'PnM': '1', 'PnW': None, 'PnD': None}), - ('P1.5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, - 'PnD':None}), ('P1,5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, 'PnD':None}), + ('P1.5M', {'PnY': None, 'PnM': '1.5', 'PnW': None, + 'PnD':None}), ('P1W', {'PnY': None, 'PnM': None, 'PnW': '1', 'PnD': None}), - ('P1.5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', - 'PnD': None}), ('P1,5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', 'PnD': None}), + ('P1.5W', {'PnY': None, 'PnM': None, 'PnW': '1.5', + 'PnD': None}), ('P1D', {'PnY': None, 'PnM': None, 'PnW': None, 'PnD': '1'}), - ('P1.5D', {'PnY': None, 'PnM': None, 'PnW': None, - 'PnD': '1.5'}), ('P1,5D', {'PnY': None, 'PnM': None, 'PnW': None, + 'PnD': '1.5'}), + ('P1.5D', {'PnY': None, 'PnM': None, 'PnW': None, 'PnD': '1.5'})) for testtuple in testtuples: @@ -377,15 +377,15 @@ testtuples = (('P1Y2M3DT4H54M6S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6'}), - ('P1Y2M3DT4H54M6.5S', {'PnY': '1', 'PnM': '2', + ('P1Y2M3DT4H54M6,5S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), - ('P1Y2M3DT4H54M6,5S', {'PnY': '1', 'PnM': '2', + ('P1Y2M3DT4H54M6.5S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), - ('PT4H54M6.5S', {'PnY': None, 'PnM': None, 'PnD': None, - 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), ('PT4H54M6,5S', {'PnY': None, 'PnM': None, 'PnD': None, + 'TnH': '4', 'TnM': '54', 'TnS': '6.5'}), + ('PT4H54M6.5S', {'PnY': None, 'PnM': None, 'PnD': None, 'TnH': '4', 'TnM': '54', 'TnS': '6.5'})) for testtuple in testtuples: @@ -436,6 +436,9 @@ testtuples = (('P0003-06-04T12:30:05', {'PnY': '0003', 'PnM': '06', 'PnD': '04', 'TnH': '12', 'TnM': '30', 'TnS': '05'}), + ('P0003-06-04T12:30:05,5', {'PnY': '0003', 'PnM': '06', + 'PnD': '04', 'TnH': '12', + 'TnM': '30', 'TnS': '05.5'}), ('P0003-06-04T12:30:05.5', {'PnY': '0003', 'PnM': '06', 'PnD': '04', 'TnH': '12', 'TnM': '30', 'TnS': '05.5'}), @@ -466,12 +469,12 @@ testtuples = (('P1Y2M3D', 'Y', '1'), ('P1Y2M3D', 'M', '2'), ('P1Y2M3D', 'D', '3'), - ('T4H5M6.1234S', 'H', '4'), - ('T4H5M6.1234S', 'M', '5'), - ('T4H5M6.1234S', 'S', '6.1234'), ('PT4H54M6,5S', 'H', '4'), ('PT4H54M6,5S', 'M', '54'), - ('PT4H54M6,5S', 'S', '6.5')) + ('PT4H54M6,5S', 'S', '6.5'), + ('T4H5M6.1234S', 'H', '4'), + ('T4H5M6.1234S', 'M', '5'), + ('T4H5M6.1234S', 'S', '6.1234')) for testtuple in testtuples: self.assertEqual(_parse_duration_element(testtuple[0], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/tests/test_interval.py new/aniso8601-8.0.0/aniso8601/tests/test_interval.py --- old/aniso8601-7.0.0/aniso8601/tests/test_interval.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.0.0/aniso8601/tests/test_interval.py 2019-09-12 02:53:18.000000000 +0200 @@ -25,6 +25,10 @@ {'end': ('1981', '04', '05', None, None, None, 'date'), 'duration': (None, '1', None, None, None, None, None, 'duration')}), + ('P1,5Y/2018-03-06', + {'end': ('2018', '03', '06', None, None, None, 'date'), + 'duration': ('1.5', None, None, None, None, None, None, + 'duration')}), ('P1.5Y/2018-03-06', {'end': ('2018', '03', '06', None, None, None, 'date'), 'duration': ('1.5', None, None, None, None, None, None, @@ -69,6 +73,11 @@ None, None, None, 'date'), 'duration': (None, '1', None, '1', None, None, None, 'duration')}), + ('2018-03-06/P2,5M', + {'start': ('2018', '03', '06', + None, None, None, 'date'), + 'duration': (None, '2.5', None, + None, None, None, None, 'duration')}), ('2018-03-06/P2.5M', {'start': ('2018', '03', '06', None, None, None, 'date'), @@ -472,6 +481,10 @@ {'end': ('1981', '04', '05', None, None, None, 'date'), 'duration': (None, '1', None, None, None, None, None, 'duration')}), + ('P1,5Y/2018-03-06', + {'end': ('2018', '03', '06', None, None, None, 'date'), + 'duration': ('1.5', None, None, None, None, None, None, + 'duration')}), ('P1.5Y/2018-03-06', {'end': ('2018', '03', '06', None, None, None, 'date'), 'duration': ('1.5', None, None, None, None, None, None, @@ -508,6 +521,11 @@ None, None, None, 'date'), 'duration': (None, '1', None, '1', None, None, None, 'duration')}), + ('2018-03-06/P2,5M', + {'start': ('2018', '03', '06', + None, None, None, 'date'), + 'duration': (None, '2.5', None, + None, None, None, None, 'duration')}), ('2018-03-06/P2.5M', {'start': ('2018', '03', '06', None, None, None, 'date'), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/tests/test_time.py new/aniso8601-8.0.0/aniso8601/tests/test_time.py --- old/aniso8601-7.0.0/aniso8601/tests/test_time.py 2019-06-11 21:12:26.000000000 +0200 +++ new/aniso8601-8.0.0/aniso8601/tests/test_time.py 2019-09-12 02:53:18.000000000 +0200 @@ -21,10 +21,14 @@ TimeResolution.Seconds) self.assertEqual(get_time_resolution('24:00:00'), TimeResolution.Seconds) + self.assertEqual(get_time_resolution('23:21:28,512400'), + TimeResolution.Seconds) self.assertEqual(get_time_resolution('23:21:28.512400'), TimeResolution.Seconds) self.assertEqual(get_time_resolution('01:23'), TimeResolution.Minutes) self.assertEqual(get_time_resolution('24:00'), TimeResolution.Minutes) + self.assertEqual(get_time_resolution('01:23,4567'), + TimeResolution.Minutes) self.assertEqual(get_time_resolution('01:23.4567'), TimeResolution.Minutes) self.assertEqual(get_time_resolution('012345'), TimeResolution.Seconds) @@ -33,6 +37,7 @@ self.assertEqual(get_time_resolution('2400'), TimeResolution.Minutes) self.assertEqual(get_time_resolution('01'), TimeResolution.Hours) self.assertEqual(get_time_resolution('24'), TimeResolution.Hours) + self.assertEqual(get_time_resolution('12,5'), TimeResolution.Hours) self.assertEqual(get_time_resolution('12.5'), TimeResolution.Hours) self.assertEqual(get_time_resolution('232128.512400+00:00'), TimeResolution.Seconds) @@ -66,6 +71,8 @@ 'ss': '45', 'tz': None}), ('24:00:00', {'hh': '24', 'mm': '00', 'ss': '00', 'tz': None}), + ('23:21:28,512400', {'hh': '23', 'mm': '21', + 'ss': '28.512400', 'tz': None}), ('23:21:28.512400', {'hh': '23', 'mm': '21', 'ss': '28.512400', 'tz': None}), ('01:03:11.858714', {'hh': '01', 'mm': '03', @@ -74,12 +81,16 @@ 'ss': '59.9999997', 'tz': None}), ('01:23', {'hh': '01', 'mm': '23', 'tz': None}), ('24:00', {'hh': '24', 'mm': '00', 'tz': None}), + ('01:23,4567', {'hh': '01', 'mm': '23.4567', + 'tz': None}), ('01:23.4567', {'hh': '01', 'mm': '23.4567', 'tz': None}), ('012345', {'hh': '01', 'mm': '23', 'ss': '45', 'tz': None}), ('240000', {'hh': '24', 'mm': '00', 'ss': '00', 'tz': None}), + ('232128,512400', {'hh': '23', 'mm': '21', + 'ss': '28.512400', 'tz': None}), ('232128.512400', {'hh': '23', 'mm': '21', 'ss': '28.512400', 'tz': None}), ('010311.858714', {'hh': '01', 'mm': '03', @@ -90,16 +101,30 @@ ('2400', {'hh': '24', 'mm': '00', 'tz': None}), ('01', {'hh': '01', 'tz': None}), ('24', {'tz': None}), + ('12,5', {'hh': '12.5', 'tz': None}), ('12.5', {'hh': '12.5', 'tz': None}), + ('232128,512400+00:00', {'hh': '23', 'mm': '21', + 'ss': '28.512400', + 'tz': (False, None, + '00', '00', + '+00:00', 'timezone')}), ('232128.512400+00:00', {'hh': '23', 'mm': '21', 'ss': '28.512400', 'tz': (False, None, '00', '00', '+00:00', 'timezone')}), + ('0123,4567+00:00', {'hh': '01', 'mm': '23.4567', + 'tz': (False, None, + '00', '00', + '+00:00', 'timezone')}), ('0123.4567+00:00', {'hh': '01', 'mm': '23.4567', 'tz': (False, None, '00', '00', '+00:00', 'timezone')}), + ('01,4567+00:00', {'hh': '01.4567', + 'tz': (False, None, + '00', '00', + '+00:00', 'timezone')}), ('01.4567+00:00', {'hh': '01.4567', 'tz': (False, None, '00', '00', @@ -203,7 +228,11 @@ mockBuilder.build_time.assert_called_once_with(**expectedargs) def test_parse_datetime(self): - testtuples = (('2019-06-05T01:03:11.858714', + testtuples = (('2019-06-05T01:03:11,858714', + (('2019', '06', '05', None, None, None, 'date'), + ('01', '03', '11.858714', + None, 'time'))), + ('2019-06-05T01:03:11.858714', (('2019', '06', '05', None, None, None, 'date'), ('01', '03', '11.858714', None, 'time'))), @@ -239,7 +268,7 @@ self.assertEqual(result, testtuple[1]) mockBuildDateTime.assert_called_once_with(*testtuple[1]) - def test_parse_datetime_spaceseperated(self): + def test_parse_datetime_spacedelimited(self): expectedargs = (('2004', None, None, '53', '6', None, 'date'), ('23', '21', '28.512400', (True, None, '12', '34', '-12:34', 'timezone'), @@ -255,6 +284,23 @@ self.assertEqual(result, expectedargs) mockBuildDateTime.assert_called_once_with(*expectedargs) + + def test_parse_datetime_commadelimited(self): + expectedargs = (('1981', '04', '05', None, None, None, 'date'), + ('23', '21', '28.512400', + (False, True, None, None, 'Z', 'timezone'), + 'time')) + + with mock.patch.object(aniso8601.time.PythonTimeBuilder, + 'build_datetime') as mockBuildDateTime: + + mockBuildDateTime.return_value = expectedargs + + result = parse_datetime('1981-04-05,23:21:28,512400Z', + delimiter=',') + + self.assertEqual(result, expectedargs) + mockBuildDateTime.assert_called_once_with(*expectedargs) def test_parse_datetime_mockbuilder(self): mockBuilder = mock.Mock() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601/time.py new/aniso8601-8.0.0/aniso8601/time.py --- old/aniso8601-7.0.0/aniso8601/time.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.0.0/aniso8601/time.py 2019-09-12 02:53:18.000000000 +0200 @@ -9,6 +9,7 @@ from aniso8601.builders import TupleBuilder from aniso8601.builders.python import PythonTimeBuilder from aniso8601.date import parse_date +from aniso8601.decimalfraction import find_separator, normalize from aniso8601.exceptions import ISOFormatError from aniso8601.resolution import TimeResolution from aniso8601.timezone import parse_timezone @@ -52,12 +53,9 @@ return TimeResolution.Minutes #Format must be hhmmss, hhmm, or hh - if timestr.find('.') == -1: - #No time fractions + timestrlen = find_separator(timestr) + if timestrlen == -1: timestrlen = len(timestr) - else: - #The lowest order element is a fraction - timestrlen = len(timestr.split('.')[0]) if timestrlen == 6: #hhmmss @@ -123,7 +121,7 @@ #date and time (<date>T<time>). Fixed offset tzdata will be included #if UTC offset is given in the input string. - isodatestr, isotimestr = isodatetimestr.split(delimiter) + isodatestr, isotimestr = isodatetimestr.split(delimiter, 1) datepart = parse_date(isodatestr, builder=TupleBuilder) @@ -138,7 +136,7 @@ if hourstr == '24': return builder.build_time(tz=tz) - return builder.build_time(hh=hourstr, tz=tz) + return builder.build_time(hh=normalize(hourstr), tz=tz) def _parse_minute_time(timestr, tz, builder): #Format must be hhmm, hhmm., hh:mm or hh:mm. @@ -150,7 +148,7 @@ hourstr = timestr[0:2] minutestr = timestr[2:] - return builder.build_time(hh=hourstr, mm=minutestr, tz=tz) + return builder.build_time(hh=normalize(hourstr), mm=normalize(minutestr), tz=tz) def _parse_second_time(timestr, tz, builder): #Format must be hhmmss, hhmmss., hh:mm:ss or hh:mm:ss. @@ -163,7 +161,8 @@ minutestr = timestr[2:4] secondstr = timestr[4:] - return builder.build_time(hh=hourstr, mm=minutestr, ss=secondstr, tz=tz) + return builder.build_time(hh=normalize(hourstr), mm=normalize(minutestr), + ss=normalize(secondstr), tz=tz) def _split_tz(isotimestr): if isotimestr.find('+') != -1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601.egg-info/PKG-INFO new/aniso8601-8.0.0/aniso8601.egg-info/PKG-INFO --- old/aniso8601-7.0.0/aniso8601.egg-info/PKG-INFO 2019-06-11 21:23:12.000000000 +0200 +++ new/aniso8601-8.0.0/aniso8601.egg-info/PKG-INFO 2019-09-12 02:58:51.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: aniso8601 -Version: 7.0.0 +Version: 8.0.0 Summary: A library for parsing ISO 8601 strings. Home-page: https://bitbucket.org/nielsenb/aniso8601 Author: Brandon Nielsen @@ -144,6 +144,13 @@ >>> aniso8601.parse_time('23.75') datetime.time(23, 45) + The decimal fraction can be specified with a comma instead of a full-stop:: + + >>> aniso8601.parse_time('22:33,5') + datetime.time(22, 33, 30) + >>> aniso8601.parse_time('23,75') + datetime.time(23, 45) + Leap seconds are currently not supported and attempting to parse one raises a :code:`LeapSecondError`:: >>> aniso8601.parse_time('23:59:60') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/aniso8601.egg-info/SOURCES.txt new/aniso8601-8.0.0/aniso8601.egg-info/SOURCES.txt --- old/aniso8601-7.0.0/aniso8601.egg-info/SOURCES.txt 2019-06-11 21:23:12.000000000 +0200 +++ new/aniso8601-8.0.0/aniso8601.egg-info/SOURCES.txt 2019-09-12 02:58:51.000000000 +0200 @@ -6,6 +6,7 @@ aniso8601/__init__.py aniso8601/compat.py aniso8601/date.py +aniso8601/decimalfraction.py aniso8601/duration.py aniso8601/exceptions.py aniso8601/interval.py @@ -25,6 +26,7 @@ aniso8601/tests/__init__.py aniso8601/tests/compat.py aniso8601/tests/test_date.py +aniso8601/tests/test_decimalfraction.py aniso8601/tests/test_duration.py aniso8601/tests/test_init.py aniso8601/tests/test_interval.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-7.0.0/setup.py new/aniso8601-8.0.0/setup.py --- old/aniso8601-7.0.0/setup.py 2019-06-11 21:21:31.000000000 +0200 +++ new/aniso8601-8.0.0/setup.py 2019-09-12 02:56:27.000000000 +0200 @@ -16,7 +16,7 @@ setup( name='aniso8601', - version='7.0.0', + version='8.0.0', description='A library for parsing ISO 8601 strings.', long_description=README_TEXT, author='Brandon Nielsen',