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@70 | 7 | s = "every single day of 2013" |
paul@70 | 8 | print s |
paul@70 | 9 | print "->", getRecurrence(s) |
paul@70 | 10 | s = "every Tuesday of 2013" |
paul@70 | 11 | print s |
paul@70 | 12 | print "->", getRecurrence(s) |
paul@70 | 13 | s = "every Wednesday of every March" |
paul@70 | 14 | print s |
paul@70 | 15 | print "->", getRecurrence(s) |
paul@70 | 16 | s = "every single day of every other February from 2013" |
paul@70 | 17 | print s |
paul@70 | 18 | print "->", getRecurrence(s) |
paul@70 | 19 | s = "every single day of every other February from 2013-02-01" |
paul@70 | 20 | print s |
paul@70 | 21 | print "->", getRecurrence(s) |
paul@70 | 22 | s = "every other day from 2013-02-01" |
paul@70 | 23 | print s |
paul@70 | 24 | print "->", getRecurrence(s) |
paul@69 | 25 | s = "every single day of the second month" |
paul@69 | 26 | print s |
paul@69 | 27 | print "->", getRecurrence(s) |
paul@69 | 28 | s = "every single day of the second month of every year" |
paul@69 | 29 | print s |
paul@69 | 30 | print "->", getRecurrence(s) |
paul@69 | 31 | s = "every other day from the first day of every other month from the third month of every year" |
paul@69 | 32 | print s |
paul@69 | 33 | print "->", getRecurrence(s) |
paul@69 | 34 | s = "the second day of every other month from the first month" |
paul@69 | 35 | print s |
paul@69 | 36 | print "->", getRecurrence(s) |
paul@69 | 37 | s = "the second hour in the second day in the second month of every year" |
paul@69 | 38 | print s |
paul@69 | 39 | print "->", getRecurrence(s) |
paul@69 | 40 | s = "every day from the second day until the 10th day of every other month until the fifth month" |
paul@69 | 41 | print s |
paul@69 | 42 | print "->", getRecurrence(s) |
paul@69 | 43 | 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 | 44 | print s |
paul@69 | 45 | print "->", getRecurrence(s) |
paul@69 | 46 | 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 | 47 | print s |
paul@69 | 48 | print "->", getRecurrence(s) |
paul@69 | 49 | |
paul@69 | 50 | # Bad recurrences. |
paul@69 | 51 | |
paul@69 | 52 | print |
paul@69 | 53 | |
paul@69 | 54 | # No start or end points. |
paul@69 | 55 | |
paul@69 | 56 | s = "every other day of every other month" |
paul@69 | 57 | print s |
paul@69 | 58 | try: |
paul@69 | 59 | print "->", getRecurrence(s) |
paul@69 | 60 | except ParseError, exc: |
paul@69 | 61 | print exc |
paul@68 | 62 | |
paul@69 | 63 | s = "every other day of every other month from the third month of every year" |
paul@69 | 64 | print s |
paul@69 | 65 | try: |
paul@69 | 66 | print "->", getRecurrence(s) |
paul@69 | 67 | except ParseError, exc: |
paul@69 | 68 | print exc |
paul@69 | 69 | |
paul@69 | 70 | s = "the second day of every other month" |
paul@69 | 71 | print s |
paul@69 | 72 | try: |
paul@69 | 73 | print "->", getRecurrence(s) |
paul@69 | 74 | except ParseError, exc: |
paul@69 | 75 | print exc |
paul@69 | 76 | |
paul@69 | 77 | s = "every day from the second day until the 10th day of every other month" |
paul@69 | 78 | print s |
paul@69 | 79 | try: |
paul@69 | 80 | print "->", getRecurrence(s) |
paul@69 | 81 | except ParseError, exc: |
paul@69 | 82 | print exc |
paul@69 | 83 | |
paul@69 | 84 | 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 | 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@69 | 90 | |
paul@69 | 91 | # Syntax error: need to use "of" instead of "in". |
paul@69 | 92 | |
paul@69 | 93 | s = "every single day in the second month" |
paul@69 | 94 | print s |
paul@69 | 95 | try: |
paul@69 | 96 | print "->", getRecurrence(s) |
paul@69 | 97 | except ParseError, exc: |
paul@69 | 98 | print exc |
paul@69 | 99 | |
paul@69 | 100 | # Out of order: days do not contain months. |
paul@69 | 101 | |
paul@69 | 102 | s = "every other month from the first month of every other day from the first day" |
paul@69 | 103 | print s |
paul@69 | 104 | try: |
paul@69 | 105 | print "->", getRecurrence(s) |
paul@69 | 106 | except ParseError, exc: |
paul@69 | 107 | print exc |
paul@68 | 108 | |
paul@68 | 109 | # vim: tabstop=4 expandtab shiftwidth=4 |