1.1 --- a/tests/internal/qualifiers.py Sat Dec 16 21:52:11 2017 +0100
1.2 +++ b/tests/internal/qualifiers.py Sat Dec 16 22:01:04 2017 +0100
1.3 @@ -98,7 +98,7 @@
1.4 print
1.5
1.6 def test5():
1.7 - qualifiers = get_qualifiers(["FREQ=DAILY", "UNTIL=19971224T000000Z"]) # UNTIL not converted
1.8 + qualifiers = get_qualifiers(["FREQ=DAILY", "UNTIL=19971224T000000Z"])
1.9 dt = (1997, 9, 2, 9, 0, 0)
1.10 s = select(dt, qualifiers)
1.11
1.12 @@ -108,6 +108,8 @@
1.13 print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
1.14 print
1.15
1.16 + # See also test43.
1.17 +
1.18 def test6():
1.19 qualifiers = [
1.20 ("DAILY", {"interval" : 2})
1.21 @@ -637,6 +639,19 @@
1.22 print l[-1] == (2017, 12, 27), (2017, 12, 27), l[-1]
1.23 print
1.24
1.25 +def test43():
1.26 + qualifiers = get_qualifiers(["FREQ=DAILY", "UNTIL=19971224T090000Z"])
1.27 + dt = (1997, 9, 2, 9, 0, 0)
1.28 + s = select(dt, qualifiers)
1.29 +
1.30 + l = s.materialise(dt, (1997, 12, 25, 0, 0, 0), True)
1.31 + print len(l) == 114, 114, len(l)
1.32 + print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.33 + print l[-1] == (1997, 12, 24, 9, 0, 0), (1997, 12, 24, 9, 0, 0), l[-1]
1.34 + print
1.35 +
1.36 + # See also test5.
1.37 +
1.38 test0 = lambda: 0 # started at 1 above
1.39
1.40 tests = [
1.41 @@ -644,7 +659,7 @@
1.42 test10, test11, test12, test13, test14, test15, test16, test17, test18, test19,
1.43 test20, test21, test22, test23, test24, test25, test26, test27, test28, test29,
1.44 test30, test31, test32, test33, test34, test35, test36, test37, test38, test39,
1.45 - test40, test41, test42
1.46 + test40, test41, test42, test43
1.47 ]
1.48
1.49 if __name__ == "__main__":
2.1 --- a/vRecurrence.py Sat Dec 16 21:52:11 2017 +0100
2.2 +++ b/vRecurrence.py Sat Dec 16 22:01:04 2017 +0100
2.3 @@ -1186,7 +1186,7 @@
2.4 "A selector ensuring that the until datetime is not passed."
2.5
2.6 def materialise_items(self, context, start, end, inclusive=False):
2.7 - return UntilIterator(self, context, start, end, inclusive,
2.8 + return UntilIterator(self, context, start, end, True,
2.9 self.get_end())
2.10
2.11 def get_end(self):
2.12 @@ -1600,7 +1600,7 @@
2.13
2.14 while True:
2.15 current = self.next_item(self.start, self.end)
2.16 - if current >= self.until:
2.17 + if current > self.until:
2.18 break
2.19 return current
2.20