File: recurrence.t

package info (click to toggle)
task 2.6.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,088 kB
  • sloc: cpp: 45,965; python: 12,713; sh: 785; perl: 189; makefile: 21
file content (664 lines) | stat: -rwxr-xr-x 24,428 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# https://www.opensource.org/licenses/mit-license.php
#
###############################################################################

import sys
import os
import re
import unittest
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from basetest import Task, TestCase


class TestRecurrenceSorting(TestCase):
    @classmethod
    def setUpClass(cls):
        """Executed once before any test in the class"""
        cls.t = Task()
        cls.t.config("report.asc.columns",  "id,recur,description")
        cls.t.config("report.asc.sort",     "recur+")
        cls.t.config("report.asc.filter",   "status:pending")
        cls.t.config("report.desc.columns", "id,recur,description")
        cls.t.config("report.desc.sort",    "recur-")
        cls.t.config("report.desc.filter",  "status:pending")

        cls.t("add one   due:tomorrow recur:daily")
        cls.t("add two   due:tomorrow recur:weekly")
        cls.t("add three due:tomorrow recur:3d")

    def setUp(self):
        """Executed before each test in the class"""

    def test_sort_ascending(self):
        """Verify sorting by 'recur+' is correct"""
        code, out, err = self.t("asc rc.verbose:nothing")
        self.assertRegex(out, "4\s+P1D\s+one\s+6\s+P3D\s+three\s+5\s+P7D\s+two")

    def test_sort_descending(self):
        """Verify sorting by 'recur-' is correct"""
        code, out, err = self.t("desc rc.verbose:nothing")
        self.assertRegex(out, "5\s+P7D\s+two\s+6\s+P3D\s+three\s+4\s+P1D\s+one")


class TestRecurrenceDisabled(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_reccurence_disabled(self):
        """
        Test that recurrent tasks are not being generated when recurrence is
        disabled.
        """

        self.t.config("recurrence", "0")
        self.t("add due:today recur:daily Recurrent task.")

        # Trigger GC, expect no match and therefore non-zero code
        self.t.runError("list")

        # Check that no task has been generated.
        code, out, err = self.t("task count")
        self.assertEqual("0", out.strip())


class TestRecurrenceLimit(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_recurrence_limit(self):
        """Verify that rc.recurrence.limit is obeyed"""
        self.t("add one due:tomorrow recur:weekly")
        code, out, err = self.t("list")
        self.assertEqual(out.count("one"), 1)

        code, out, err = self.t("list rc.recurrence.limit:4")
        self.assertEqual(out.count("one"), 4)


class TestRecurrenceWeekdays(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_recurrence_weekdays(self):
        """Verify that 'recur:weekdays' skips weekends"""

        # Add a 'recur:weekdays' task due on a friday, which forces the next
        # instance to be monday, thereby skipping the weekend.
        self.t("add due:friday recur:weekdays one")

        # Get the original due date as a julian date.
        self.t("list")  # GC/handleRecurrence
        code, friday, err = self.t("_get 2.due.julian")

        # Generate the second instance, obtain due date.
        self.t("list rc.recurrence.limit:2")  # GC/handleRecurrence
        code, monday, err = self.t("_get 3.due.julian")

        # The due dates should be Friday and Monday, three days apart,
        # having skipped the weekend.
        # Note: On daylight savings in the fall, this '3' becomes '2.9583'.
        # Note: when monday is next year, friday+2 > 365
        self.assertTrue(int(monday.strip()) >= (int(friday.strip()) + 2) % 365)


class TestRecurrenceUntil(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_recurrence_until(self):
        """Verify that an 'until' date terminates recurrence"""

        self.t("add one due:now+1minute recur:PT1H until:now+125minutes")
        code, out, err = self.t("list rc.verbose:nothing")
        self.assertEqual(out.count("one"), 1)

        # All three expected tasks are shown:
        #   - PT1M
        #   - PT61M
        #   - PT121M
        #   - Nothing after PT125M
        self.t.faketime("+3h")
        code, out, err = self.t("list rc.verbose:nothing")
        self.assertEqual(out.count("one"), 3)

        # This test verifies that 'until' propagates to the instances, which
        # was not the original intention, but has been this way for a a while.
        # Given that the original decision was arbitrary, this is no worse.
        # We shall preserve recent behavior.
        self.t.faketime("+24h")
        code, out, err = self.t("( status:pending or status:recurring ) count")
        self.assertEqual("0\n", out)
        self.assertIn("Task 2 'one' expired and was deleted.", err)
        self.assertIn("Task 3 'one' expired and was deleted.", err)
        self.assertIn("Task 4 'one' expired and was deleted.", err)


class TestRecurrenceTasks(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()
        self.t("add simple")
        self.t("add complex due:today recur:daily")

    def test_change_propagation(self):
        """Verify that changes (modify, delete) are propagated correctly"""

        # List tasks to generate child tasks.  Should result in:
        #   1 simple
        #   3 complex
        #   4 complex
        code, out, err = self.t("minimal rc.verbose:nothing")
        self.assertRegex(out, "1\s+simple")
        self.assertRegex(out, "3\s+complex")
        self.assertRegex(out, "4\s+complex")

        # Modify a child task and do not propagate the change.
        self.t("3 modify complex2", input="n\n")
        code, out, err = self.t("_get 3.description")
        self.assertEqual("complex2\n", out)
        code, out, err = self.t("_get 4.description")
        self.assertEqual("complex\n", out)

        # Modify a child task and propagate the change.
        self.t("3 modify complex3", input="y\n")
        code, out, err = self.t("_get 3.description")
        self.assertEqual("complex3\n", out)
        code, out, err = self.t("_get 4.description")
        self.assertEqual("complex3\n", out)

        # Delete a child task, do not propagate.
        code, out, err = self.t("3 delete", input="y\n")
        self.assertIn("Deleted 1 task.", out)

        # Delete a child task, propagate.
        self.t("minimal")
        code, out, err = self.t("3 delete", input="y\n")
        self.assertIn("Deleted 1 task.", out)

        # Check for duplicate UUIDs.
        code, out, err = self.t("diag")
        self.assertIn("No duplicates found", out)


class TestBug972(TestCase):
    def setUp(self):
        """972: Executed before each test in the class"""
        self.t = Task()

    def test_interpretation_of_seven(self):
        """Bug 972: A recurrence period of "7" is interpreted as "7s", not "7d"
           as intended.
        """
        code, out, err = self.t.runError("add one due:now recur:2")
        self.assertIn("The duration value '2' is not supported.", err)


class TestDeletionRecurrence(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_delete_parent(self):
        """Delete a parent with child tasks"""
        self.t("add one due:eom recur:daily")
        self.t("list") # GC/handleRecurrence
        code, out, err = self.t("1 delete", input="y\ny\n")
        self.assertIn("Deleted 2 tasks.", out)

        code, out, err = self.t.runError("list")
        self.assertIn("No matches.", err)

    def test_delete_child_with_siblings(self):
        """Delete a child with sibling tasks"""
        self.t("add one due:eom recur:daily")
        self.t("list rc.recurrence.limit:5")
        code, out, err = self.t("list rc.verbose:nothing") # GC/handleRecurrence
        self.assertEqual(out.count("one"), 5)

        code, out, err = self.t("2 delete", input="y\ny\n")
        self.assertIn("Deleted 5 tasks.", out)


class TestAppendPrependRecurrence(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_append_propagate(self):
        """Append and propagate"""
        self.t("add one due:eom recur:daily")
        self.t("list rc.recurrence.limit:2") # GC/handleRecurrence

        code, out, err = self.t("2 append APP", input="y\n")
        self.assertIn("Appended 2 tasks.", out)

    def test_prepend_propagate(self):
        """Prepend and propagate"""
        self.t("add one due:eom recur:daily")
        self.t("list rc.recurrence.limit:2") # GC/handleRecurrence

        code, out, err = self.t("2 prepend PRE", input="y\n")
        self.assertIn("Prepended 2 tasks.", out)


class TestNoDueDate(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_no_due_date(self):
        """Look for an error when adding a recurring task with no due date"""
        code, out, err = self.t.runError("add foo recur:daily")
        self.assertIn("A recurring task must also have a 'due' date.", err)


class TestBug932(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()
        self.t.config("report.id_pri_proj.columns", "id,priority,project")
        self.t.config("report.id_pri_proj.labels", "ID,P,Proj")

    def test_modify_due_propagate(self):
        """932: Verify due date modifications propagate"""

        # add a recurring task with multiple child tasks
        # - modify a child task and test for propagation
        # - modify the parent task and test for propagation
        self.t("add R due:yesterday recur:daily")
        self.t("list")  # GC/handleRecurrence

        self.t("2 modify project:P", input="y\n")
        code, out, err = self.t("id_pri_proj")
        self.assertIn("2 P", out)
        self.assertIn("3 P", out)
        self.assertIn("4 P", out)

        self.t("1 modify priority:H", input="y\n")
        code, out, err = self.t("id_pri_proj")
        self.assertIn("2 H P", out)
        self.assertIn("3 H P", out)
        self.assertIn("4 H P", out)


class TestBug955(TestCase):
    def setUp(self):
        self.t = Task()

        self.t("add foo due:now recur:1day")
        code, out, err = self.t("ls")
        self.assertRegex(out, re.compile("^2 tasks", re.MULTILINE))

    def test_no_prompt_for_parent_on_child_delete_confirmation_off(self):
        """955: Deleting a child of a recurring task prompts for parent deletion (confirmation:off)

        Previously bug.955.t
        """

        # With confirmation:off the first "n\n" has no effect.
        self.t.config("confirmation", "0")
        code, out, err = self.t("2 delete", input="n\ny\n")
        self.assertIn("Deleting task 2", out)
        self.assertIn("Deleted 1 task", out)

        # 1 task remains.
        code, out, err = self.t("ls")
        self.assertRegex(out, re.compile("^1 task", re.MULTILINE))

        code, out, err = self.t("2 delete", input="y\ny\n")
        self.assertIn("Deleting task 2", out)
        self.assertIn("Deleted 1 task", out)

        code, out, err = self.t.runError("all status:recurring")
        self.assertIn("No matches", err)

        code, out, err = self.t.runError("ls")
        self.assertIn("No matches", err)

    def test_no_prompt_for_parent_on_child_delete_confirmation_on(self):
        """Deleting a child of a recurring task prompts for parent deletion (confirmation:on)

        Previously bug.955.t
        """

        # With confirmation:on the first "n\n" is obeyed.
        self.t.config("confirmation", "1")
        code, out, err = self.t.runError("2 delete", input="n\ny\n")
        self.assertIn("Deleted 0 tasks.", out)

        # 2 tasks intact.
        code, out, err = self.t("ls")
        self.assertRegex(out, re.compile("^2 tasks", re.MULTILINE))

        code, out, err = self.t("2 delete", input="y\ny\n")
        self.assertIn("Deleted 2 tasks", out)

        code, out, err = self.t.runError("all status:recurring")
        self.assertIn("No matches", err) 

        code, out, err = self.t.runError("ls")
        self.assertIn("No matches", err)

class TestUpgradeToRecurring(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_upgrade(self):
        """Upgrade task to recurring"""
        self.t("add foo")
        self.t("1 modify due:tomorrow recur:weekly")
        code, out, err = self.t("_get 1.status")
        self.assertEqual("recurring\n", out)

    def test_failed_upgrade(self):
        """Attempt an upgrade, but omit the due date"""
        self.t("add foo")
        code, out, err = self.t.runError("1 modify recur:weekly")
        self.assertIn("You cannot specify a recurring task without a due date.", err)

class TestRecurrenceNotification(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_notification(self):
        """Test notification on task creation"""

        self.t("add foo due:eow recur:daily")

        code, out, err = self.t("list")
        self.assertIn("Creating recurring task instance 'foo'", err)

        code, out, err = self.t("list")
        self.assertNotIn("Creating recurring task instance 'foo'", err)

class BaseTestBug360(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()
        self.t("add foo due:tomorrow recur:daily")
        # This command forces a handleRecurrence() call to generate synthetic tasks.
        self.t("ls")

class TestBug360RemovalError(BaseTestBug360):
    def test_modify_recursive_project(self):
        """360: Modifying a recursive task by adding project: also modifies parent
        """
        code, out, err = self.t("1 modify project:bar", input="y\n")

        expected = "Modified 2 tasks."
        self.assertIn(expected, out)
        expected = "You cannot remove the recurrence from a recurring task."
        self.assertNotIn(expected, err)

    def test_cannot_remove_recurrence(self):
        """360: Cannot remove recurrence from recurring task
        """
        # TODO Removing recur: from a recurring task should also remove imask
        # and parent.

        code, out, err = self.t.runError("2 modify recur:")
        # Expected non zero exit-code
        self.assertEqual(code, 2)

        expected = "You cannot remove the recurrence from a recurring task."
        self.assertIn(expected, err)

    def test_cannot_remove_due_date(self):
        """360: Cannot remove due date from recurring task
        """
        # TODO Removing due: from a recurring task should also remove recur,
        # imask and parent
        code, out, err = self.t.runError("2 modify due:")
        # Expected non zero exit-code
        self.assertEqual(code, 2)

        expected = "You cannot remove the due date from a recurring task."
        self.assertIn(expected, err)


class TestBug360AllowedChanges(BaseTestBug360):
    def setUp(self):
        """Executed before each test in the class"""
        # Also do setUp from BaseTestBug360
        super(TestBug360AllowedChanges, self).setUp()

        self.t("add nonrecurring due:today")

    def test_allow_modify_due_in_nonrecurring(self):
        """360: Allow modifying due date in non recurring task"""
        # Retrieve the id of the non recurring task
        code, out, err = self.t("ls")

        expected = "2 tasks"
        self.assertIn(expected, out)

        # NOTE: raw python string r"" avoids having to escape backslashes
        id = re.search(r"(\d+)\s.+\snonrecurring", out).group(1)

        code, out, err = self.t((id, "modify", "due:"))

        expected = "Modified 1 task."
        self.assertIn(expected, out)
        expected = "You cannot remove the due date from a recurring task."
        self.assertNotIn(expected, err)

        # Make sure no duplicate tasks were created
        code, out, err = self.t.diag()
        expected = "No duplicates found"
        self.assertIn(expected, out)

class TestBug649(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_delete_recurring_immediately(self):
        """649: Verify that recurring tasks cannot be immediately marked completed"""
        self.t("add one due:3d recur:1week")
        code, out, err = self.t.runError("1 done")
        self.assertIn("is neither pending nor waiting", out)
        self.assertNotIn("Completed 1", out)

class TestBugC001(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_id_increment(self):
        """C001: Verify that entering two consecutive recurring tasks increments reported ID"""
        code, out, err = self.t("add one due:tomorrow recur:daily")
        code, out, err = self.t("add two due:tomorrow recur:daily")

class TestBug839(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_recurrence_value_mapping(self):
        """839: Verify that importing a legacy recurrence value is ok"""
        json = '{"description":"one","due":"1437579505","recur":"1m","status":"recurring","uuid":"ebeeab00-ccf8-464b-8b58-f7f2d606edfb"}'
        self.t("import -", input=json)

        code, out, err = self.t("list")
        self.assertIn("one", out)
        self.assertNotIn("The recurrence value '1m' is not valid.", out)


class TestPeriod(TestCase):
    @classmethod
    def setUpClass(cls):
        """Executed once before any test in the class"""

    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_recurrence_periods(self):
       """Verify recurrence period special-case support

       Date getNextRecurrence (Date& current, std::string& period)

       Confirmed:
         getNextRecurrence  convertDuration
         -----------------  ---------------
                            daily
                            day
                            weekly
                            sennight
                            biweekly
                            fortnight
         monthly            monthly
         quarterly          quarterly
         semiannual         semiannual
         bimonthly          bimonthly
         biannual           biannual
         biyearly           biyearly
                            annual
                            yearly
         *m                 *m
         *q                 *q
                            *d
                            *w
                            *y
       """

       self.t("add daily due:tomorrow recur:daily")
       self.t("add 1day due:tomorrow recur:1day")
       self.t("add weekly due:tomorrow recur:weekly")
       self.t("add 1sennight due:tomorrow recur:1sennight")
       self.t("add biweekly due:tomorrow recur:biweekly")
       self.t("add fortnight due:tomorrow recur:fortnight")
       self.t("add monthly due:tomorrow recur:monthly")
       self.t("add quarterly due:tomorrow recur:quarterly")
       self.t("add semiannual due:tomorrow recur:semiannual")
       self.t("add bimonthly due:tomorrow recur:bimonthly")
       self.t("add biannual due:tomorrow recur:biannual")
       self.t("add biyearly due:tomorrow recur:biyearly")
       self.t("add annual due:tomorrow recur:annual")
       self.t("add yearly due:tomorrow recur:yearly")
       self.t("add 2d due:tomorrow recur:2d")
       self.t("add 2w due:tomorrow recur:2w")
       self.t("add 2mo due:tomorrow recur:2mo")
       self.t("add 2q due:tomorrow recur:2q")
       self.t("add 2y due:tomorrow recur:2y")

       # Verify that the recurring task instances were created.  One of each.
       code, out, err = self.t("list")
       self.assertIn(" daily ",      out);
       self.assertIn(" 1day ",       out);
       self.assertIn(" weekly ",     out);
       self.assertIn(" 1sennight ",  out);
       self.assertIn(" biweekly ",   out);
       self.assertIn(" fortnight ",  out);
       self.assertIn(" monthly ",    out);
       self.assertIn(" quarterly ",  out);
       self.assertIn(" semiannual ", out);
       self.assertIn(" bimonthly ",  out);
       self.assertIn(" biannual ",   out);
       self.assertIn(" biyearly ",   out);
       self.assertIn(" annual ",     out);
       self.assertIn(" yearly ",     out);
       self.assertIn(" 2d ",         out);
       self.assertIn(" 2w ",         out);
       self.assertIn(" 2mo ",        out);
       self.assertIn(" 2q ",         out);
       self.assertIn(" 2y ",         out);

       # Duplicate check
       code, out, err = self.t("diag")
       self.assertIn("No duplicates found", out)


class TestBugAnnual(TestCase):
    def setUp(self):
        """Executed before each test in the class"""
        self.t = Task()

    def test_annual_creep(self):
        """Verify 'annual' recurring tasks don't creep"""
        self.t.config("dateformat",            "YMD")
        self.t.config("report.annual.labels",  "ID,Due")
        self.t.config("report.annual.columns", "id,due")
        self.t.config("report.annual.filter",  "status:pending")
        self.t.config("report.annual.sort",    "due+")

        # If a task is added with a due date ten years ago, with an annual recurrence,
        # then the synthetic tasks in between then and now have a due date that creeps.
        #
        # ID Due        Description
        # -- ---------- -----------
        #  4 1/1/2002   foo
        #  5 1/1/2003   foo
        #  6 1/1/2004   foo
        #  7 1/1/2005   foo
        #  8 1/1/2006   foo
        #  9 1/1/2007   foo
        # 10 1/1/2008   foo
        # 11 1/1/2009   foo
        # 12 1/1/2010   foo
        #  2 1/1/2000   foo
        #  3 1/1/2001   foo

        self.t("add foo due:20000101 recur:annual until:20150101")
        code, out, err = self.t("annual")
        self.assertIn(" 2 20000101", out)
        self.assertIn(" 3 20010101", out)
        self.assertIn(" 4 20020101", out)
        self.assertIn(" 5 20030101", out)
        self.assertIn(" 6 20040101", out)
        self.assertIn(" 7 20050101", out)
        self.assertIn(" 8 20060101", out)
        self.assertIn(" 9 20070101", out)
        self.assertIn("10 20080101", out)
        self.assertIn("11 20090101", out)
        self.assertIn("12 20100101", out)
        self.assertIn("13 20110101", out)
        self.assertIn("14 20120101", out)
        self.assertIn("15 20130101", out)
        self.assertIn("16 20140101", out)
        self.assertIn("17 20150101", out)


# TODO Wait a recurring task
# TODO Downgrade a recurring task to a regular task
# TODO Duplicate a recurring child task
# TODO Duplicate a recurring parent task


if __name__ == "__main__":
    from simpletap import TAPTestRunner
    unittest.main(testRunner=TAPTestRunner())

# vim: ai sts=4 et sw=4 ft=python