paul@68 | 1 | #!/usr/bin/env python |
paul@68 | 2 | |
paul@69 | 3 | from RecurrenceSupport import getRecurrence, ParseError |
paul@69 | 4 | |
paul@69 | 5 | # Good recurrences. |
paul@69 | 6 | |
paul@69 | 7 | s = "every single day of the second month" |
paul@69 | 8 | print s |
paul@69 | 9 | print "->", getRecurrence(s) |
paul@69 | 10 | s = "every single day of the second month of every year" |
paul@69 | 11 | print s |
paul@69 | 12 | print "->", getRecurrence(s) |
paul@69 | 13 | s = "every other day from the first day of every other month from the third month of every year" |
paul@69 | 14 | print s |
paul@69 | 15 | print "->", getRecurrence(s) |
paul@69 | 16 | s = "the second day of every other month from the first month" |
paul@69 | 17 | print s |
paul@69 | 18 | print "->", getRecurrence(s) |
paul@69 | 19 | s = "the second hour in the second day in the second month of every year" |
paul@69 | 20 | print s |
paul@69 | 21 | print "->", getRecurrence(s) |
paul@69 | 22 | s = "every day from the second day until the 10th day of every other month until the fifth month" |
paul@69 | 23 | print s |
paul@69 | 24 | print "->", getRecurrence(s) |
paul@69 | 25 | s = "every day from the 10th day in the second month until the 10th day in the 10th month of every third month from the first month" |
paul@69 | 26 | print s |
paul@69 | 27 | print "->", getRecurrence(s) |
paul@69 | 28 | s = "every day of every third month from the 10th day in the second month until the 10th day in the 10th month" |
paul@69 | 29 | print s |
paul@69 | 30 | print "->", getRecurrence(s) |
paul@69 | 31 | |
paul@69 | 32 | # Bad recurrences. |
paul@69 | 33 | |
paul@69 | 34 | print |
paul@69 | 35 | |
paul@69 | 36 | # No start or end points. |
paul@69 | 37 | |
paul@69 | 38 | s = "every other day of every other month" |
paul@69 | 39 | print s |
paul@69 | 40 | try: |
paul@69 | 41 | print "->", getRecurrence(s) |
paul@69 | 42 | except ParseError, exc: |
paul@69 | 43 | print exc |
paul@68 | 44 | |
paul@69 | 45 | s = "every other day of every other month from the third month of every year" |
paul@69 | 46 | print s |
paul@69 | 47 | try: |
paul@69 | 48 | print "->", getRecurrence(s) |
paul@69 | 49 | except ParseError, exc: |
paul@69 | 50 | print exc |
paul@69 | 51 | |
paul@69 | 52 | s = "the second day of every other month" |
paul@69 | 53 | print s |
paul@69 | 54 | try: |
paul@69 | 55 | print "->", getRecurrence(s) |
paul@69 | 56 | except ParseError, exc: |
paul@69 | 57 | print exc |
paul@69 | 58 | |
paul@69 | 59 | s = "every day from the second day until the 10th day of every other month" |
paul@69 | 60 | print s |
paul@69 | 61 | try: |
paul@69 | 62 | print "->", getRecurrence(s) |
paul@69 | 63 | except ParseError, exc: |
paul@69 | 64 | print exc |
paul@69 | 65 | |
paul@69 | 66 | s = "every day from the 10th day in the second month until the 10th day in the 10th month of every third month" |
paul@69 | 67 | print s |
paul@69 | 68 | try: |
paul@69 | 69 | print "->", getRecurrence(s) |
paul@69 | 70 | except ParseError, exc: |
paul@69 | 71 | print exc |
paul@69 | 72 | |
paul@69 | 73 | # Syntax error: need to use "of" instead of "in". |
paul@69 | 74 | |
paul@69 | 75 | s = "every single day in the second month" |
paul@69 | 76 | print s |
paul@69 | 77 | try: |
paul@69 | 78 | print "->", getRecurrence(s) |
paul@69 | 79 | except ParseError, exc: |
paul@69 | 80 | print exc |
paul@69 | 81 | |
paul@69 | 82 | # Out of order: days do not contain months. |
paul@69 | 83 | |
paul@69 | 84 | s = "every other month from the first month of every other day from the first day" |
paul@69 | 85 | print s |
paul@69 | 86 | try: |
paul@69 | 87 | print "->", getRecurrence(s) |
paul@69 | 88 | except ParseError, exc: |
paul@69 | 89 | print exc |
paul@68 | 90 | |
paul@68 | 91 | # vim: tabstop=4 expandtab shiftwidth=4 |