diff options
author | niemeyer <> | 2010-03-30 00:35:20 +0000 |
---|---|---|
committer | niemeyer <> | 2010-03-30 00:35:20 +0000 |
commit | 27bf3ec9d045b3b2ceee376f3b662f057836a76f (patch) | |
tree | e113a7b2765c3e51d0bfa3a36adcc267f2432a84 | |
parent | 49178742953cc63b066d2142d9e2b3f0f2e20e17 (diff) | |
download | dateutil-27bf3ec9d045b3b2ceee376f3b662f057836a76f.tar.gz |
As reported by Mathieu Bridon, rrules were matching the bysecond rules
incorrectly against byminute in some circumstances when the SECONDLY
frequency was in use, due to a copy & paste bug. The problem has been
tested and corrected.
-rw-r--r-- | dateutil/rrule.py | 2 | ||||
-rw-r--r-- | test.py | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/dateutil/rrule.py b/dateutil/rrule.py index 4c21d2d..8c63cf2 100644 --- a/dateutil/rrule.py +++ b/dateutil/rrule.py @@ -439,7 +439,7 @@ class rrule(rrulebase): (freq >= MINUTELY and self._byminute and minute not in self._byminute) or (freq >= SECONDLY and - self._bysecond and minute not in self._bysecond)): + self._bysecond and second not in self._bysecond)): timeset = () else: timeset = gettimeset(hour, minute, second) @@ -2372,6 +2372,17 @@ class RRuleTest(unittest.TestCase): datetime(1997, 9, 2, 18, 6, 18), datetime(1997, 9, 2, 18, 18, 6)]) + def testSecondlyByHourAndMinuteAndSecondBug(self): + # This explores a bug found by Mathieu Bridon. + self.assertEqual(list(rrule(SECONDLY, + count=3, + bysecond=(0,), + byminute=(1,), + dtstart=parse("20100322120100"))), + [datetime(2010, 3, 22, 12, 1), + datetime(2010, 3, 22, 13, 1), + datetime(2010, 3, 22, 14, 1)]) + def testUntilNotMatching(self): self.assertEqual(list(rrule(DAILY, count=3, |