コード例 #1
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #2
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #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)
コード例 #4
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #5
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #9
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #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)
コード例 #11
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #12
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #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)
コード例 #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)
コード例 #15
0
ファイル: DoCommand.py プロジェクト: bram85/topydo
    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.")
コード例 #16
0
ファイル: DoCommand.py プロジェクト: wzel/topydo
    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.")
コード例 #17
0
ファイル: DoCommand.py プロジェクト: rtvb/topydo
    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.")
コード例 #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.")
コード例 #19
0
ファイル: test_recurrence.py プロジェクト: rameshg87/topydo
    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)
コード例 #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)