Exemple #1
0
    def test_duedate6(self):
        """ Where due date is today. """
        today = date.today()
        new_due = date.today() + timedelta(7)

        self.todo.set_tag(config().tag_due(), today.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #2
0
    def test_duedate4(self):
        """ Where due date is in the past. """
        past = date.today() - timedelta(8)
        new_due = date.today() - timedelta(1)

        self.todo.set_tag(config().tag_due(), past.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #3
0
    def test_duedate6(self):
        """ Where due date is today. """
        today = date.today()
        new_due = date.today() + timedelta(7)

        self.todo.set_tag(config().tag_due(), today.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #4
0
    def test_startdate3(self):
        """ Start date equals due date. """
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        self.todo.set_tag(config().tag_start(), date.today().isoformat())

        new_start = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo)

        self.assertEqual(new_todo.start_date(), new_start)
Exemple #5
0
    def test_duedate5(self):
        """ Where due date is in the future. """
        future = date.today() + timedelta(1)
        new_due = date.today() + timedelta(8)

        self.todo.set_tag(config().tag_due(), future.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #6
0
    def test_duedate5(self):
        """ Where due date is in the future. """
        future = date.today() + timedelta(1)
        new_due = date.today() + timedelta(8)

        self.todo.set_tag(config().tag_due(), future.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #7
0
    def test_duedate4(self):
        """ Where due date is in the past. """
        past = date.today() - timedelta(8)
        new_due = date.today() - timedelta(1)

        self.todo.set_tag(config().tag_due(), past.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #8
0
    def test_startdate3(self):
        """ Start date equals due date. """
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        self.todo.set_tag(config().tag_start(), date.today().isoformat())

        new_start = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo)

        self.assertEqual(new_todo.start_date(), new_start)
Exemple #9
0
    def test_startdate1(self):
        """ Start date is before due date. """
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        yesterday = date.today() - timedelta(1)
        self.todo.set_tag(config().tag_start(), yesterday.isoformat())

        new_start = date.today() + timedelta(6)
        new_todo = advance_recurring_todo(self.todo)

        self.assertEqual(new_todo.start_date(), new_start)
Exemple #10
0
    def test_startdate1(self):
        """ Start date is before due date. """
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        yesterday = date.today() - timedelta(1)
        self.todo.set_tag(config().tag_start(), yesterday.isoformat())

        new_start = date.today() + timedelta(6)
        new_todo = advance_recurring_todo(self.todo)

        self.assertEqual(new_todo.start_date(), new_start)
Exemple #11
0
    def test_strict_recurrence2(self):
        """
        Strict recurrence where due date is in the future, using + notation in
        expression.
        """
        future = date.today() + timedelta(1)
        new_due = date.today() + timedelta(8)

        self.stricttodo.set_tag(config().tag_due(), future.isoformat())
        new_todo = advance_recurring_todo(self.stricttodo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #12
0
    def test_startdate2(self):
        """ Strict recurrence. Start date is before due date. """
        due = date.today() - timedelta(1)
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        yesterday = due - timedelta(1)
        # pylint: disable=E1103
        self.todo.set_tag(config().tag_start(), yesterday.isoformat())

        new_start = date.today() + timedelta(5)
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.start_date(), new_start)
Exemple #13
0
    def test_strict_recurrence2(self):
        """
        Strict recurrence where due date is in the future, using + notation in
        expression.
        """
        future = date.today() + timedelta(1)
        new_due = date.today() + timedelta(8)

        self.stricttodo.set_tag(config().tag_due(), future.isoformat())
        new_todo = advance_recurring_todo(self.stricttodo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)
Exemple #14
0
    def test_startdate2(self):
        """ Strict recurrence. Start date is before due date. """
        due = date.today() - timedelta(1)
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        yesterday = due - timedelta(1)
        # pylint: disable=E1103
        self.todo.set_tag(config().tag_start(), yesterday.isoformat())

        new_start = date.today() + timedelta(5)
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.start_date(), new_start)
Exemple #15
0
    def _handle_recurrence(self, p_todo):
        if p_todo.has_tag('rec'):
            try:
                new_todo = advance_recurring_todo(
                    p_todo,
                    p_offset=self.completion_date,
                    p_strict=self.strict_recurrence
                )

                self.todolist.add_todo(new_todo)

            except NoRecurrenceException:
                self.error("Warning: todo item has an invalid recurrence pattern.")
Exemple #16
0
    def _handle_recurrence(self, p_todo):
        if p_todo.has_tag('rec'):
            try:
                new_todo = advance_recurring_todo(
                    p_todo,
                    p_offset=self.completion_date,
                    p_strict=self.strict_recurrence)

                self.todolist.add_todo(new_todo)

            except NoRecurrenceException:
                self.error(
                    "Warning: todo item has an invalid recurrence pattern.")
Exemple #17
0
    def _handle_recurrence(self, p_todo):
        if p_todo.has_tag('rec'):
            try:
                new_todo = advance_recurring_todo(
                    p_todo,
                    p_offset=self.completion_date,
                    p_strict=self.strict_recurrence
                )

                self.todolist.add_todo(new_todo)

                printer = PrettyPrinter()
                printer.add_filter(PrettyPrinterNumbers(self.todolist))
                self.out(printer.print_todo(new_todo))
            except NoRecurrenceException:
                self.error("Warning: todo item has an invalid recurrence pattern.")
Exemple #18
0
    def _handle_recurrence(self, p_todo):
        if p_todo.has_tag('rec'):
            try:
                if self.strict_recurrence:
                    new_todo = strict_advance_recurring_todo(p_todo,
                        self.completion_date)
                else:
                    new_todo = advance_recurring_todo(p_todo,
                        self.completion_date)

                self.todolist.add_todo(new_todo)

                printer = PrettyPrinter()
                printer.add_filter(PrettyPrinterNumbers(self.todolist))
                self.out(printer.print_todo(new_todo))
            except NoRecurrenceException:
                self.error("Warning: todo item has an invalid recurrence pattern.")
Exemple #19
0
    def test_noduedate2(self):
        new_due = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertTrue(new_todo.has_tag(config().tag_due()))
        self.assertEqual(new_todo.due_date(), new_due)
Exemple #20
0
    def test_noduedate2(self):
        new_due = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertTrue(new_todo.has_tag(config().tag_due()))
        self.assertEqual(new_todo.due_date(), new_due)