Hello community, here is the log from the commit of package python-aniso8601 for openSUSE:Factory checked in at 2020-12-21 10:24:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-aniso8601 (Old) and /work/SRC/openSUSE:Factory/.python-aniso8601.new.5145 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-aniso8601" Mon Dec 21 10:24:11 2020 rev:8 rq:857119 version:8.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-aniso8601/python-aniso8601.changes 2020-04-23 18:32:47.588358114 +0200 +++ /work/SRC/openSUSE:Factory/.python-aniso8601.new.5145/python-aniso8601.changes 2020-12-21 10:26:55.308218270 +0100 @@ -1,0 +2,19 @@ +Sun Dec 20 09:47:26 UTC 2020 - Dirk Müller <dmuel...@suse.com> + +- update to 8.1.0: + * Empty string arguments to get_date_resolution and parse_date now raise ISOFormatError, fixes 26 + * None and non-string arguments to get_date_resolution and parse_date now raise ValueError + * Empty string arguments to parse_duration now raise ISOFormatError + * None and non-string arguments to parse_duration now raise ValueError + * Empty string arguments to parse_interval and parse_repeating_interval now raise ISOFormatError + * None and non-string arguments to parse_interval and parse_repeating_internval now raise ValueError + * Empty string arguments to get_time_resolution and parse_time now raise ISOFormatError + * None and non-string arguments to parse_time now raise ValueError + * None and non-string arguments to parse_timezone now raise ValueError + * Empty string arguments to parse_datetime now raise ISOFormatError + * None and non-string arguments to parse_datetime now raise ValueError + * Missing delimiter in datetime strings when calling parse_datetime now raises ISOFormatError + * Missing delimiter in regular and repeating interval strings when calling parse_interval and parse_repeating_interval now raises ISOFormatError + * get_time_resolution now correctly throws ISOFormatError when a time component has too many characters in a time using ":" as a separator + +------------------------------------------------------------------- Old: ---- aniso8601-8.0.0.tar.gz New: ---- aniso8601-8.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-aniso8601.spec ++++++ --- /var/tmp/diff_new_pack.cnYxAf/_old 2020-12-21 10:26:55.944218991 +0100 +++ /var/tmp/diff_new_pack.cnYxAf/_new 2020-12-21 10:26:55.948218996 +0100 @@ -20,7 +20,7 @@ %define modname aniso8601 %bcond_without python2 Name: python-%{modname} -Version: 8.0.0 +Version: 8.1.0 Release: 0 Summary: A library for parsing ISO 8601 strings License: BSD-3-Clause ++++++ aniso8601-8.0.0.tar.gz -> aniso8601-8.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/LICENSE new/aniso8601-8.1.0/LICENSE --- old/aniso8601-8.0.0/LICENSE 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/LICENSE 2020-11-23 20:26:01.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2019, Brandon Nielsen +Copyright (c) 2020, Brandon Nielsen All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/PKG-INFO new/aniso8601-8.1.0/PKG-INFO --- old/aniso8601-8.0.0/PKG-INFO 2019-09-12 02:58:51.000000000 +0200 +++ new/aniso8601-8.1.0/PKG-INFO 2020-11-30 21:16:01.733981800 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: aniso8601 -Version: 8.0.0 +Version: 8.1.0 Summary: A library for parsing ISO 8601 strings. Home-page: https://bitbucket.org/nielsenb/aniso8601 Author: Brandon Nielsen @@ -75,13 +75,13 @@ >>> aniso8601.parse_datetime('2018-03-06T23:59:60') Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/time.py", line 131, in parse_datetime + File "aniso8601/time.py", line 135, in parse_datetime return builder.build_datetime(datepart, timepart) - File "aniso8601/builder.py", line 300, in build_datetime + File "aniso8601/builders/python.py", line 176, in build_datetime cls._build_object(time)) - File "aniso8601/builder.py", line 71, in _build_object - ss=parsetuple[2], tz=parsetuple[3]) - File "aniso8601/builder.py", line 253, in build_time + File "aniso8601/builders/__init__.py", line 63, in _build_object + return cls.build_time(hh=parsetuple[0], mm=parsetuple[1], + File "aniso8601/builders/python.py", line 134, in build_time raise LeapSecondError('Leap seconds are not supported.') aniso8601.exceptions.LeapSecondError: Leap seconds are not supported. @@ -156,11 +156,11 @@ >>> aniso8601.parse_time('23:59:60') Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/time.py", line 116, in parse_time - return _RESOLUTION_MAP[get_time_resolution(timestr)](timestr, tz, builder) - File "aniso8601/time.py", line 165, in _parse_second_time - return builder.build_time(hh=hourstr, mm=minutestr, ss=secondstr, tz=tz) - File "aniso8601/builder.py", line 253, in build_time + File "aniso8601/time.py", line 113, in parse_time + return _RESOLUTION_MAP[timeresolution](timestr, tz, builder) + File "aniso8601/time.py", line 169, in _parse_second_time + return builder.build_time(hh=normalize(hourstr), mm=normalize(minutestr), + File "aniso8601/builders/python.py", line 134, in build_time raise LeapSecondError('Leap seconds are not supported.') aniso8601.exceptions.LeapSecondError: Leap seconds are not supported. @@ -257,7 +257,7 @@ >>> list(aniso8601.parse_repeating_interval('R/PT1H2M/1980-03-05T01:01:00')) Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/builders/python.py", line 463, in _date_generator_unbounded + File "aniso8601/builders/python.py", line 419, in _date_generator_unbounded currentdate += timedelta OverflowError: date value out of range @@ -421,4 +421,6 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/README.rst new/aniso8601-8.1.0/README.rst --- old/aniso8601-8.0.0/README.rst 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/README.rst 2020-11-24 03:24:37.000000000 +0100 @@ -64,13 +64,13 @@ >>> aniso8601.parse_datetime('2018-03-06T23:59:60') Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/time.py", line 131, in parse_datetime + File "aniso8601/time.py", line 135, in parse_datetime return builder.build_datetime(datepart, timepart) - File "aniso8601/builder.py", line 300, in build_datetime + File "aniso8601/builders/python.py", line 176, in build_datetime cls._build_object(time)) - File "aniso8601/builder.py", line 71, in _build_object - ss=parsetuple[2], tz=parsetuple[3]) - File "aniso8601/builder.py", line 253, in build_time + File "aniso8601/builders/__init__.py", line 63, in _build_object + return cls.build_time(hh=parsetuple[0], mm=parsetuple[1], + File "aniso8601/builders/python.py", line 134, in build_time raise LeapSecondError('Leap seconds are not supported.') aniso8601.exceptions.LeapSecondError: Leap seconds are not supported. @@ -145,11 +145,11 @@ >>> aniso8601.parse_time('23:59:60') Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/time.py", line 116, in parse_time - return _RESOLUTION_MAP[get_time_resolution(timestr)](timestr, tz, builder) - File "aniso8601/time.py", line 165, in _parse_second_time - return builder.build_time(hh=hourstr, mm=minutestr, ss=secondstr, tz=tz) - File "aniso8601/builder.py", line 253, in build_time + File "aniso8601/time.py", line 113, in parse_time + return _RESOLUTION_MAP[timeresolution](timestr, tz, builder) + File "aniso8601/time.py", line 169, in _parse_second_time + return builder.build_time(hh=normalize(hourstr), mm=normalize(minutestr), + File "aniso8601/builders/python.py", line 134, in build_time raise LeapSecondError('Leap seconds are not supported.') aniso8601.exceptions.LeapSecondError: Leap seconds are not supported. @@ -246,7 +246,7 @@ >>> list(aniso8601.parse_repeating_interval('R/PT1H2M/1980-03-05T01:01:00')) Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/builders/python.py", line 463, in _date_generator_unbounded + File "aniso8601/builders/python.py", line 419, in _date_generator_unbounded currentdate += timedelta OverflowError: date value out of range diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/__init__.py new/aniso8601-8.1.0/aniso8601/__init__.py --- old/aniso8601-8.0.0/aniso8601/__init__.py 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/__init__.py 2020-11-23 20:30:16.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/builders/__init__.py new/aniso8601-8.1.0/aniso8601/builders/__init__.py --- old/aniso8601-8.0.0/aniso8601/builders/__init__.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/builders/__init__.py 2020-11-23 20:31:43.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/builders/python.py new/aniso8601-8.1.0/aniso8601/builders/python.py --- old/aniso8601-8.0.0/aniso8601/builders/python.py 2019-06-11 21:12:26.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/builders/python.py 2020-11-23 20:31:59.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/builders/tests/__init__.py new/aniso8601-8.1.0/aniso8601/builders/tests/__init__.py --- old/aniso8601-8.0.0/aniso8601/builders/tests/__init__.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/builders/tests/__init__.py 2020-11-23 20:32:57.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/builders/tests/test_init.py new/aniso8601-8.1.0/aniso8601/builders/tests/test_init.py --- old/aniso8601-8.0.0/aniso8601/builders/tests/test_init.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/builders/tests/test_init.py 2020-11-23 20:32:42.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/builders/tests/test_python.py new/aniso8601-8.1.0/aniso8601/builders/tests/test_python.py --- old/aniso8601-8.0.0/aniso8601/builders/tests/test_python.py 2019-06-11 21:12:26.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/builders/tests/test_python.py 2020-11-23 20:33:05.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/compat.py new/aniso8601-8.1.0/aniso8601/compat.py --- old/aniso8601-8.0.0/aniso8601/compat.py 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/compat.py 2020-11-23 20:31:26.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/date.py new/aniso8601-8.1.0/aniso8601/date.py --- old/aniso8601-8.0.0/aniso8601/date.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/date.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -23,13 +23,18 @@ #YYYYWwwD #YYYY-DDD #YYYYDDD + if not isinstance(isodatestr, str): + raise ValueError('Date must be string.') + if isodatestr.startswith('+') or isodatestr.startswith('-'): raise NotImplementedError('ISO 8601 extended year representation ' 'not supported.') - if isodatestr[0].isdigit() is False or isodatestr[-1].isdigit() is False: + if (len(isodatestr) == 0 or + isodatestr[0].isdigit() is False + or isodatestr[-1].isdigit() is False): raise ISOFormatError('"{0}" is not a valid ISO 8601 date.' - .format(isodatestr)) + .format(isodatestr)) if isodatestr.find('W') != -1: #Handle ISO 8601 week date format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/decimalfraction.py new/aniso8601-8.1.0/aniso8601/decimalfraction.py --- old/aniso8601-8.0.0/aniso8601/decimalfraction.py 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/decimalfraction.py 2020-11-23 20:30:56.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/duration.py new/aniso8601-8.1.0/aniso8601/duration.py --- old/aniso8601-8.0.0/aniso8601/duration.py 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/duration.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -21,6 +21,13 @@ #PnYnMnDTnHnMnS (or any reduced precision equivalent) #P<date>T<time> + if not isinstance(isodurationstr, str): + raise ValueError('Duration must be string.') + + if len(isodurationstr) == 0: + raise ISOFormatError('"{0}" is not a valid ISO 8601 duration.' + .format(isodurationstr)) + if isodurationstr[0] != 'P': raise ISOFormatError('ISO 8601 duration must start with a P.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/exceptions.py new/aniso8601-8.1.0/aniso8601/exceptions.py --- old/aniso8601-8.0.0/aniso8601/exceptions.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/exceptions.py 2020-11-23 20:30:27.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/interval.py new/aniso8601-8.1.0/aniso8601/interval.py --- old/aniso8601-8.0.0/aniso8601/interval.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/interval.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -32,6 +32,17 @@ #Is expressly not supported as there is no way to provide the additional #required context. + if not isinstance(isointervalstr, str): + raise ValueError('Interval must be string.') + + if len(isointervalstr) == 0: + raise ISOFormatError('Interval string is empty.') + + if intervaldelimiter not in isointervalstr: + raise ISOFormatError('Interval delimiter "{0}" is not in interval ' + 'string "{1}".' + .format(intervaldelimiter, isointervalstr)) + if isointervalstr[0] == 'R': raise ISOFormatError('ISO 8601 repeating intervals must be parsed ' 'with parse_repeating_interval.') @@ -47,6 +58,17 @@ #Rnn/<interval> #R/<interval> + if not isinstance(isointervalstr, str): + raise ValueError('Interval must be string.') + + if len(isointervalstr) == 0: + raise ISOFormatError('Repeating interval string is empty.') + + if intervaldelimiter not in isointervalstr: + raise ISOFormatError('Interval delimiter "{0}" is not in interval ' + 'string "{1}".' + .format(intervaldelimiter, isointervalstr)) + if isointervalstr[0] != 'R': raise ISOFormatError('ISO 8601 repeating interval must start ' 'with an R.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/resolution.py new/aniso8601-8.1.0/aniso8601/resolution.py --- old/aniso8601-8.0.0/aniso8601/resolution.py 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/resolution.py 2020-11-23 20:29:50.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/__init__.py new/aniso8601-8.1.0/aniso8601/tests/__init__.py --- old/aniso8601-8.0.0/aniso8601/tests/__init__.py 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/tests/__init__.py 2020-11-23 20:29:30.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/compat.py new/aniso8601-8.1.0/aniso8601/tests/compat.py --- old/aniso8601-8.0.0/aniso8601/tests/compat.py 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/tests/compat.py 2020-11-23 20:29:15.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_date.py new/aniso8601-8.1.0/aniso8601/tests/test_date.py --- old/aniso8601-8.0.0/aniso8601/tests/test_date.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/tests/test_date.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -43,6 +43,42 @@ self.assertEqual(get_date_resolution('1981095'), DateResolution.Ordinal) + def test_get_date_resolution_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + get_date_resolution(testtuple) + + def test_get_date_resolution_extended_year(self): + testtuples = ('+2000', '+30000') + + for testtuple in testtuples: + with self.assertRaises(NotImplementedError): + get_date_resolution(testtuple) + + def test_get_date_resolution_badweek(self): + testtuples = ('2004-W1', '2004W1') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + get_date_resolution(testtuple) + + def test_get_date_resolution_badweekday(self): + testtuples = ('2004-W53-67', '2004W5367') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + get_date_resolution(testtuple) + + def test_get_date_resolution_badstr(self): + testtuples = ('W53', '2004-W', '2014-01-230', '2014-012-23', + '201-01-23', '201401230', '201401', 'bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + get_date_resolution(testtuple) + class TestDateParserFunctions(unittest.TestCase): def test_parse_date(self): testtuples = (('2013', {'YYYY': '2013'}), @@ -69,6 +105,21 @@ self.assertEqual(result, testtuple[1]) mockBuildDate.assert_called_once_with(**testtuple[1]) + def test_parse_date_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_date(testtuple, builder=None) + + def test_parse_date_badstr(self): + testtuples = ('W53', '2004-W', '2014-01-230', '2014-012-23', + '201-01-23', '201401230', '201401', 'bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_date(testtuple, builder=None) + def test_parse_date_mockbuilder(self): mockBuilder = mock.Mock() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_decimalfraction.py new/aniso8601-8.1.0/aniso8601/tests/test_decimalfraction.py --- old/aniso8601-8.0.0/aniso8601/tests/test_decimalfraction.py 2019-09-12 02:55:32.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/tests/test_decimalfraction.py 2020-11-23 20:28:35.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_duration.py new/aniso8601-8.1.0/aniso8601/tests/test_duration.py --- old/aniso8601-8.0.0/aniso8601/tests/test_duration.py 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/tests/test_duration.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -106,6 +106,13 @@ self.assertEqual(result, expectedargs) mockBuilder.build_duration.assert_called_once_with(**expectedargs) + def test_parse_duration_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_duration(testtuple, builder=None) + def test_parse_duration_nop(self): with self.assertRaises(ISOFormatError): #Duration must start with a P @@ -173,6 +180,13 @@ with self.assertRaises(ISOFormatError): parse_duration('PT1S1H', builder=None) + def test_parse_duration_badstr(self): + testtuples = ('bad', '') + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_duration(testtuple, builder=None) + def test_parse_duration_prescribed(self): testtuples = (('P1Y2M3DT4H54M6S', {'PnY': '1', 'PnM': '2', 'PnD': '3', 'TnH': '4', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_init.py new/aniso8601-8.1.0/aniso8601/tests/test_init.py --- old/aniso8601-8.0.0/aniso8601/tests/test_init.py 2019-01-08 22:27:49.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/tests/test_init.py 2020-11-23 20:29:01.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_interval.py new/aniso8601-8.1.0/aniso8601/tests/test_interval.py --- old/aniso8601-8.0.0/aniso8601/tests/test_interval.py 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/tests/test_interval.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -269,6 +269,28 @@ self.assertEqual(result, expectedargs) mockBuilder.build_interval.assert_called_once_with(**expectedargs) + def test_parse_interval_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_interval(testtuple, builder=None) + + def test_parse_interval_baddelimiter(self): + testtuples = ('1980-03-05T01:01:00,1981-04-05T01:01:00', + 'P1M 1981-04-05T01:01:00') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_interval(testtuple, builder=None) + + def test_parse_interval_badstr(self): + testtuples = ('bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_interval(testtuple, builder=None) + def test_parse_interval_repeating(self): #Parse interval can't parse repeating intervals with self.assertRaises(ISOFormatError): @@ -283,16 +305,16 @@ def test_parse_interval_suffixgarbage(self): #Don't allow garbage after the duration #https://bitbucket.org/nielsenb/aniso8601/issues/9/durations-with-trailing-garbage-are-parsed - with self.assertRaises(ValueError): + with self.assertRaises(ISOFormatError): parse_interval('2001/P1Dasdf', builder=None) - with self.assertRaises(ValueError): + with self.assertRaises(ISOFormatError): parse_interval('P1Dasdf/2001', builder=None) - with self.assertRaises(ValueError): + with self.assertRaises(ISOFormatError): parse_interval('2001/P0003-06-04T12:30:05.5asdfasdf', builder=None) - with self.assertRaises(ValueError): + with self.assertRaises(ISOFormatError): parse_interval('P0003-06-04T12:30:05.5asdfasdf/2001', builder=None) class TestRepeatingIntervalParserFunctions(unittest.TestCase): @@ -458,6 +480,20 @@ self.assertEqual(result, args) mockBuilder.build_repeating_interval.assert_called_once_with(**args) + def test_parse_repeating_interval_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_repeating_interval(testtuple, builder=None) + + def test_parse_repeating_interval_baddelimiter(self): + testtuples = ('R,PT1H2M,1980-03-05T01:01:00', 'R3 1981-04-05 P1D') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_repeating_interval(testtuple, builder=None) + def test_parse_repeating_interval_suffixgarbage(self): #Don't allow garbage after the duration #https://bitbucket.org/nielsenb/aniso8601/issues/9/durations-with-trailing-garbage-are-parsed @@ -470,6 +506,13 @@ 'P0003-06-04T12:30:05.5asdfasdf', builder=None) + def test_parse_repeating_interval_badstr(self): + testtuples = ('bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_repeating_interval(testtuple, builder=None) + def test_parse_interval_internal(self): #Test the internal _parse_interval function testtuples = (('P1M/1981-04-05T01:01:00', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_time.py new/aniso8601-8.1.0/aniso8601/tests/test_time.py --- old/aniso8601-8.0.0/aniso8601/tests/test_time.py 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/tests/test_time.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -9,13 +9,14 @@ import unittest import aniso8601 +from aniso8601.exceptions import ISOFormatError from aniso8601.resolution import TimeResolution from aniso8601.time import (get_time_resolution, parse_datetime, parse_time, _parse_hour, _parse_minute_time, _parse_second_time, _split_tz) from aniso8601.tests.compat import mock -class TestTimeParserFunctions(unittest.TestCase): +class TestTimeResolutionFunctions(unittest.TestCase): def test_get_time_resolution(self): self.assertEqual(get_time_resolution('01:23:45'), TimeResolution.Seconds) @@ -66,6 +67,21 @@ self.assertEqual(get_time_resolution('06:14:00.000123Z'), TimeResolution.Seconds) + def test_get_time_resolution_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + get_time_resolution(testtuple) + + def test_get_time_resolution_badstr(self): + testtuples = ('A6:14:00.000123Z', '06:14:0B', 'bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + get_time_resolution(testtuple) + +class TestTimeParserFunctions(unittest.TestCase): def test_parse_time(self): testtuples = (('01:23:45', {'hh': '01', 'mm': '23', 'ss': '45', 'tz': None}), @@ -191,6 +207,20 @@ self.assertEqual(result, testtuple[1]) mockBuildTime.assert_called_once_with(**testtuple[1]) + def test_parse_time_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_time(testtuple, builder=None) + + def test_parse_time_badstr(self): + testtuples = ('A6:14:00.000123Z', '06:14:0B', 'bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_time(testtuple, builder=None) + def test_parse_time_mockbuilder(self): mockBuilder = mock.Mock() @@ -302,6 +332,34 @@ self.assertEqual(result, expectedargs) mockBuildDateTime.assert_called_once_with(*expectedargs) + def test_parse_datetime_baddelimiter(self): + testtuples = ('1981-04-05,23:21:28,512400Z', + '2004-W53-6 23:21:28.512400-12:3', + '1981040523:21:28') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_datetime(testtuple, builder=None) + + def test_parse_datetime_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_datetime(testtuple, builder=None) + + def test_parse_datetime_badstr(self): + testtuples = ('1981-04-05TA6:14:00.000123Z', + '2004-W53-6T06:14:0B', + '2014-01-230T23:21:28+00', + '201401230T01:03:11.858714', + 'bad', + '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_time(testtuple, builder=None) + def test_parse_datetime_mockbuilder(self): mockBuilder = mock.Mock() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_timezone.py new/aniso8601-8.1.0/aniso8601/tests/test_timezone.py --- old/aniso8601-8.0.0/aniso8601/tests/test_timezone.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/tests/test_timezone.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -62,6 +62,20 @@ self.assertEqual(result, testtuple[1]) mockBuildTimezone.assert_called_once_with(**testtuple[1]) + def test_parse_timezone_badtype(self): + testtuples = (None, 1, False, 1.234) + + for testtuple in testtuples: + with self.assertRaises(ValueError): + parse_timezone(testtuple, builder=None) + + def test_parse_timezone_badstr(self): + testtuples = ('+1', '-00', '-0000', '-00:00', '01', '0123', 'bad', '') + + for testtuple in testtuples: + with self.assertRaises(ISOFormatError): + parse_timezone(testtuple, builder=None) + def test_parse_timezone_mockbuilder(self): mockBuilder = mock.Mock() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/tests/test_utcoffset.py new/aniso8601-8.1.0/aniso8601/tests/test_utcoffset.py --- old/aniso8601-8.0.0/aniso8601/tests/test_utcoffset.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/tests/test_utcoffset.py 2020-11-23 20:28:47.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/time.py new/aniso8601-8.1.0/aniso8601/time.py --- old/aniso8601-8.0.0/aniso8601/time.py 2019-09-12 02:53:18.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601/time.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -42,15 +42,16 @@ #hh:mm±hh #hhmm±hh #hh±hh + if not isinstance(isotimestr, str): + raise ValueError('Time must be string.') - timestr = _split_tz(isotimestr)[0] + timestr = _split_tz(isotimestr)[0].replace(':', '') - if timestr.count(':') == 2: - #hh:mm:ss - return TimeResolution.Seconds - elif timestr.count(':') == 1: - #hh:mm - return TimeResolution.Minutes + if (len(timestr) == 0 or + timestr[0].isdigit() is False or + timestr[-1].isdigit() is False): + raise ISOFormatError('"{0}" is not a valid ISO 8601 time.' + .format(timestr)) #Format must be hhmmss, hhmm, or hh timestrlen = find_separator(timestr) @@ -100,19 +101,16 @@ #hh:mm±hh #hhmm±hh #hh±hh + timeresolution = get_time_resolution(isotimestr) (timestr, tzstr) = _split_tz(isotimestr) - if timestr[0].isdigit() is False or timestr[-1].isdigit() is False: - raise ISOFormatError('"{0}" is not a valid ISO 8601 time.' - .format(timestr)) - if tzstr is None: tz = None else: tz = parse_timezone(tzstr, builder=TupleBuilder) - return _RESOLUTION_MAP[get_time_resolution(timestr)](timestr, tz, builder) + return _RESOLUTION_MAP[timeresolution](timestr, tz, builder) def parse_datetime(isodatetimestr, delimiter='T', builder=PythonTimeBuilder): #Given a string in ISO 8601 date time format, return a datetime.datetime @@ -120,6 +118,13 @@ #By default, the ISO 8601 specified T delimiter is used to split the #date and time (<date>T<time>). Fixed offset tzdata will be included #if UTC offset is given in the input string. + if not isinstance(isodatetimestr, str): + raise ValueError('Date time must be string.') + + if delimiter not in isodatetimestr: + raise ISOFormatError('Delimiter "{0}" is not in combined date time ' + 'string "{1}".' + .format(delimiter, isodatetimestr)) isodatestr, isotimestr = isodatetimestr.split(delimiter, 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/timezone.py new/aniso8601-8.1.0/aniso8601/timezone.py --- old/aniso8601-8.0.0/aniso8601/timezone.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/timezone.py 2020-11-24 03:10:00.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms @@ -11,6 +11,9 @@ def parse_timezone(tzstr, builder=PythonTimeBuilder): #tzstr can be Z, ±hh:mm, ±hhmm, ±hh + if not isinstance(tzstr, str): + raise ValueError('Time zone must be string.') + if 'Z' in tzstr: if len(tzstr) != 1: raise ISOFormatError('"{0}" is not a valid ISO 8601 time offset.' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601/utcoffset.py new/aniso8601-8.1.0/aniso8601/utcoffset.py --- old/aniso8601-8.0.0/aniso8601/utcoffset.py 2019-03-01 21:54:25.000000000 +0100 +++ new/aniso8601-8.1.0/aniso8601/utcoffset.py 2020-11-23 20:26:49.000000000 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2019, Brandon Nielsen +# Copyright (c) 2020, Brandon Nielsen # All rights reserved. # # This software may be modified and distributed under the terms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/aniso8601.egg-info/PKG-INFO new/aniso8601-8.1.0/aniso8601.egg-info/PKG-INFO --- old/aniso8601-8.0.0/aniso8601.egg-info/PKG-INFO 2019-09-12 02:58:51.000000000 +0200 +++ new/aniso8601-8.1.0/aniso8601.egg-info/PKG-INFO 2020-11-30 21:16:01.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: aniso8601 -Version: 8.0.0 +Version: 8.1.0 Summary: A library for parsing ISO 8601 strings. Home-page: https://bitbucket.org/nielsenb/aniso8601 Author: Brandon Nielsen @@ -75,13 +75,13 @@ >>> aniso8601.parse_datetime('2018-03-06T23:59:60') Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/time.py", line 131, in parse_datetime + File "aniso8601/time.py", line 135, in parse_datetime return builder.build_datetime(datepart, timepart) - File "aniso8601/builder.py", line 300, in build_datetime + File "aniso8601/builders/python.py", line 176, in build_datetime cls._build_object(time)) - File "aniso8601/builder.py", line 71, in _build_object - ss=parsetuple[2], tz=parsetuple[3]) - File "aniso8601/builder.py", line 253, in build_time + File "aniso8601/builders/__init__.py", line 63, in _build_object + return cls.build_time(hh=parsetuple[0], mm=parsetuple[1], + File "aniso8601/builders/python.py", line 134, in build_time raise LeapSecondError('Leap seconds are not supported.') aniso8601.exceptions.LeapSecondError: Leap seconds are not supported. @@ -156,11 +156,11 @@ >>> aniso8601.parse_time('23:59:60') Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/time.py", line 116, in parse_time - return _RESOLUTION_MAP[get_time_resolution(timestr)](timestr, tz, builder) - File "aniso8601/time.py", line 165, in _parse_second_time - return builder.build_time(hh=hourstr, mm=minutestr, ss=secondstr, tz=tz) - File "aniso8601/builder.py", line 253, in build_time + File "aniso8601/time.py", line 113, in parse_time + return _RESOLUTION_MAP[timeresolution](timestr, tz, builder) + File "aniso8601/time.py", line 169, in _parse_second_time + return builder.build_time(hh=normalize(hourstr), mm=normalize(minutestr), + File "aniso8601/builders/python.py", line 134, in build_time raise LeapSecondError('Leap seconds are not supported.') aniso8601.exceptions.LeapSecondError: Leap seconds are not supported. @@ -257,7 +257,7 @@ >>> list(aniso8601.parse_repeating_interval('R/PT1H2M/1980-03-05T01:01:00')) Traceback (most recent call last): File "<stdin>", line 1, in <module> - File "aniso8601/builders/python.py", line 463, in _date_generator_unbounded + File "aniso8601/builders/python.py", line 419, in _date_generator_unbounded currentdate += timedelta OverflowError: date value out of range @@ -421,4 +421,6 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aniso8601-8.0.0/setup.py new/aniso8601-8.1.0/setup.py --- old/aniso8601-8.0.0/setup.py 2019-09-12 02:56:27.000000000 +0200 +++ new/aniso8601-8.1.0/setup.py 2020-11-30 21:11:27.000000000 +0100 @@ -16,7 +16,7 @@ setup( name='aniso8601', - version='8.0.0', + version='8.1.0', description='A library for parsing ISO 8601 strings.', long_description=README_TEXT, author='Brandon Nielsen', @@ -38,6 +38,8 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: Software Development :: Libraries :: Python Modules' ], keywords='iso8601 parser', _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org