Compare aace90e ... +0 ... 158da71


@@ -1,6 +1,7 @@
Loading
1 1
# -*- coding: utf-8 -*-
2 2
from __future__ import unicode_literals
3 3
4 +
import re
4 5
from datetime import datetime, date
5 6
import unittest
6 7
from six import PY2, assertRaisesRegex
@@ -4615,12 +4616,13 @@
Loading
4615 4616
                             [datetime(1997, 1, 6)])
4616 4617
4617 4618
    def testRaisesCorrectErrorForUnsupportedProperty(self):
4618 -
        rule = "X-ABC-MMSUBJ:19970902T090000"
4619 -
        assertRaisesRegex(self, ValueError, "unsupported property", rrulestr, rule, dtstart=datetime(1997, 9, 2, 9, 0))
4619 +
        with pytest.raises(ValueError, match=re.escape("X-ABC-MMSUBJ")):
4620 +
            rrulestr("X-ABC-MMSUBJ:19970902T090000")
4620 4621
4621 4622
    def testRaisesCorrectErrorIfDatetimeContainsColons(self):
4622 4623
        rule = "FREQ=YEARLY;WKST=MO;UNTIL=2019-03-29T00:59:59"
4623 -
        self.assertRaises(ValueError, rrulestr, rule, dtstart=datetime(1997, 9, 2, 9, 0))
4624 +
        with pytest.raises(ValueError, match=re.escape(rule)):
4625 +
            rrulestr(rule)
4624 4626
4625 4627
4626 4628
@pytest.mark.rrule

@@ -1699,7 +1699,13 @@
Loading
1699 1699
                else:
1700 1700
                    if re.match("^[A-Za-z0-9-]+$", name):
1701 1701
                        raise ValueError("unsupported property: " + name)
1702 -
                    raise ValueError("RRULE line contains invalid colon or property: " + line)
1702 +
                    raise ValueError(
1703 +
                        "RRULE contains invalid property or stray colon:\n"
1704 +
                        + line + "\n\n"
1705 +
                        + "This commonly occurs when specifying a datetime "
1706 +
                        + "using delimiters, e.g. 2025-06-07T12:34:56; RFC "
1707 +
                        + "5545 requires datetimes specified with no "
1708 +
                        + "delimiters, e.g. 20250607T123456")
1703 1709
            if (forceset or len(rrulevals) > 1 or rdatevals
1704 1710
                    or exrulevals or exdatevals):
1705 1711
                if not parser and (rdatevals or exdatevals):

Learn more Showing 1 files with coverage changes found.

Changes in dateutil/zoneinfo/rebuild.py
+1
+5
Loading file...
Files Coverage
dateutil -0.06% 95.95%
Project Totals (32 files) 95.95%
Loading