コード例 #1
0
    def test_activated_todos2(self):
        command = DoCommand(["7"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output, "Completed: x {} Subtodo of inactive p:2\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #2
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_activated_todos2(self):
        command = DoCommand(["7"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output, "Completed: x {} Subtodo of inactive p:2\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #3
0
    def test_expr_do3(self):
        command = DoCommand(["-e", "@test", "due:2015-06-03", "+project"],
                            self.todolist, self.out, self.error, None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
コード例 #4
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_expr_do3(self):
        command = DoCommand(["-e", "@test", "due:2015-06-03", "+project"],
                            self.todolist, self.out, self.error, None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
コード例 #5
0
    def test_help(self):
        command = DoCommand(["help"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output, "")
        self.assertEqual(self.errors,
                         command.usage() + "\n\n" + command.help() + "\n")
コード例 #6
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_invalid2(self):
        command = DoCommand(["AAA"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Invalid todo number given.\n")
コード例 #7
0
    def test_empty(self):
        command = DoCommand([], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, command.usage() + "\n")
コード例 #8
0
    def test_multi_do4(self):
        command = DoCommand(["99", "3"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.todo(3).is_completed())
        self.assertEqual(self.errors, "Invalid todo number given: 99.\n")
コード例 #9
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_multi_do4(self):
        command = DoCommand(["99", "3"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.todo(3).is_completed())
        self.assertEqual(self.errors, "Invalid todo number given: 99.\n")
コード例 #10
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_empty(self):
        command = DoCommand([], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, command.usage() + "\n")
コード例 #11
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_help(self):
        command = DoCommand(["help"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output, "")
        self.assertEqual(self.errors,
                         command.usage() + "\n\n" + command.help() + "\n")
コード例 #12
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def _recurrence_helper(self, p_flags):
        command = DoCommand(p_flags, self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.errors, "")
        self.assertEqual(self.todolist.count(), 12)
コード例 #13
0
    def test_expr_do4(self):
        """ Don't do anything with unrelevant todo items. """
        command = DoCommand(["-e", "Foo"], self.todolist, self.out, self.error,
                            None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
コード例 #14
0
    def _recurrence_helper(self, p_flags):
        command = DoCommand(p_flags, self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.errors, "")
        self.assertEqual(self.todolist.count(), 12)
コード例 #15
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_expr_do4(self):
        """ Don't do anything with unrelevant todo items. """
        command = DoCommand(["-e", "Foo"], self.todolist, self.out, self.error,
                            None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
コード例 #16
0
    def test_invalid2(self):
        command = DoCommand(["AAA"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Invalid todo number given.\n")
コード例 #17
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_expr_do2(self):
        command = DoCommand(["-e", "@test", "due:2015-06-03"], self.todolist,
                            self.out, self.error, None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Completed: x {} a @test with due:2015-06-03\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #18
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_multi_do3(self):
        command = DoCommand(["3", "3"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.todo(3).is_completed())
        self.assertEqual(self.output,
                         "Completed: x {} Baz p:1\n".format(self.today))
コード例 #19
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date3(self):
        command = DoCommand(["--date=2014-11-18", "3"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n")
        self.assertEqual(self.errors, "")
コード例 #20
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date2(self):
        command = DoCommand(["-d", "2014-11-18", "1"], self.todolist, self.out,
                            self.error, _yes_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x 2014-11-18 Bar p:1\nCompleted: x 2014-11-18 Baz p:1\nCompleted: x 2014-11-18 Foo id:1\n")
        self.assertEqual(self.errors, "")
コード例 #21
0
    def test_multi_do3(self):
        command = DoCommand(["3", "3"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.todo(3).is_completed())
        self.assertEqual(self.output,
                         "Completed: x {} Baz p:1\n".format(self.today))
コード例 #22
0
    def test_do_custom_date3(self):
        command = DoCommand(["--date=2014-11-18", "3"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n")
        self.assertEqual(self.errors, "")
コード例 #23
0
    def test_do_custom_date2(self):
        command = DoCommand(["-d", "2014-11-18", "1"], self.todolist, self.out,
                            self.error, _yes_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x 2014-11-18 Bar p:1\nCompleted: x 2014-11-18 Baz p:1\nCompleted: x 2014-11-18 Foo id:1\n")
        self.assertEqual(self.errors, "")
コード例 #24
0
    def test_expr_do2(self):
        command = DoCommand(["-e", "@test", "due:2015-06-03"], self.todolist,
                            self.out, self.error, None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Completed: x {} a @test with due:2015-06-03\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #25
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_multi_do5(self):
        """
        Check output when all supplied todo numbers are invalid.
        """
        command = DoCommand(["99", "15"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: 15.\n")
コード例 #26
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_regex1(self):
        command = DoCommand(["baz"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertTrue(self.todolist.todo(3).is_completed())
        self.assertEqual(self.output,
                         "Completed: x {} Baz p:1\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #27
0
    def test_multi_do5(self):
        """
        Check output when all supplied todo numbers are invalid.
        """
        command = DoCommand(["99", "15"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: 15.\n")
コード例 #28
0
    def test_do_regex1(self):
        command = DoCommand(["baz"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertTrue(self.todolist.todo(3).is_completed())
        self.assertEqual(self.output,
                         "Completed: x {} Baz p:1\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #29
0
    def test_do_custom_date4(self):
        command = DoCommand(["-d", "foo", "3"], self.todolist, self.out,
                            self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output,
                         "Completed: x {} Baz p:1\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #30
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_already_complete(self):
        command = DoCommand(["5"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(5).completion_date(),
                         date(2014, 10, 18))
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Todo has already been completed.\n")
コード例 #31
0
    def test_already_complete(self):
        command = DoCommand(["5"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(5).completion_date(),
                         date(2014, 10, 18))
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Todo has already been completed.\n")
コード例 #32
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date4(self):
        command = DoCommand(["-d", "foo", "3"], self.todolist, self.out,
                            self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output,
                         "Completed: x {} Baz p:1\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #33
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_multi_do2(self):
        command = DoCommand(["1", "3"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.todo(1).is_completed())
        self.assertFalse(self.todolist.todo(2).is_completed())
        self.assertTrue(self.todolist.todo(3).is_completed())

        self.assertEqual(self.output, "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {today} Foo id:1\nCompleted: x {today} Baz p:1\n".format(today=self.today))
コード例 #34
0
    def test_multi_do2(self):
        command = DoCommand(["1", "3"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.todo(1).is_completed())
        self.assertFalse(self.todolist.todo(2).is_completed())
        self.assertTrue(self.todolist.todo(3).is_completed())

        self.assertEqual(self.output, "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {today} Foo id:1\nCompleted: x {today} Baz p:1\n".format(today=self.today))
コード例 #35
0
    def test_do_custom_date8(self):
        """
        Convert relative completion dates to an absolute date (yesterday).
        """
        command = DoCommand(["-d", "yesterday", "3"], self.todolist, self.out,
                            self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Completed: x {} Baz p:1\n".format(self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #36
0
    def test_multi_do6(self):
        """
        Throw an error with invalid argument containing special characters.
        """
        command = DoCommand([u"Fo\u00d3B\u0105r", "Bar"], self.todolist,
                            self.out, self.error, None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.errors,
                         u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
コード例 #37
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_invalid_recurrence(self):
        """
        Show error message when an item has an invalid recurrence pattern.
        """
        command = DoCommand(["9"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output,
                         "Completed: x {} Invalid rec:1\n".format(self.today))
        self.assertEqual(self.errors, "Warning: todo item has an invalid recurrence pattern.\n")
コード例 #38
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date8(self):
        """
        Convert relative completion dates to an absolute date (yesterday).
        """
        command = DoCommand(["-d", "yesterday", "3"], self.todolist, self.out,
                            self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Completed: x {} Baz p:1\n".format(self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #39
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_multi_do6(self):
        """
        Throw an error with invalid argument containing special characters.
        """
        command = DoCommand([u"Fo\u00d3B\u0105r", "Bar"], self.todolist,
                            self.out, self.error, None)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.errors,
                         u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
コード例 #40
0
    def test_invalid_recurrence(self):
        """
        Show error message when an item has an invalid recurrence pattern.
        """
        command = DoCommand(["9"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output,
                         "Completed: x {} Invalid rec:1\n".format(self.today))
        self.assertEqual(self.errors, "Warning: todo item has an invalid recurrence pattern.\n")
コード例 #41
0
    def test_expr_do5(self):
        """ Force marking unrelevant items as done with additional -x flag. """
        command = DoCommand(["-xe", "Foo"], self.todolist, self.out,
                            self.error, _yes_prompt)
        command.execute()
        command.execute_post_archive_actions()

        result = "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {t} Bar p:1\nCompleted: x {t} Baz p:1\nCompleted: x {t} Foo id:1\n".format(t=self.today)

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
コード例 #42
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_expr_do5(self):
        """ Force marking unrelevant items as done with additional -x flag. """
        command = DoCommand(["-xe", "Foo"], self.todolist, self.out,
                            self.error, _yes_prompt)
        command.execute()
        command.execute_post_archive_actions()

        result = "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {t} Bar p:1\nCompleted: x {t} Baz p:1\nCompleted: x {t} Foo id:1\n".format(t=self.today)

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
コード例 #43
0
    def test_do_subtasks_force2(self):
        def prompt(p_prompt):
            prompt.prompt_shown = True

        prompt.prompt_shown = False

        command = DoCommand(["--force", "1"], self.todolist, self.out,
                            self.error, prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(prompt.prompt_shown)
        self.assertEqual(self.errors, "")
        self.assertFalse(self.todolist.todo(2).is_completed())
コード例 #44
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_subtasks2(self):
        command = DoCommand(["1"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        result = "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {} Foo id:1\n".format(self.today)

        self.assertTrue(self.todolist.dirty)
        self.assertTrue(self.todolist.todo(1).is_completed())
        self.assertFalse(self.todolist.todo(2).is_completed())
        self.assertFalse(self.todolist.todo(3).is_completed())
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
コード例 #45
0
    def test_do_subtasks2(self):
        command = DoCommand(["1"], self.todolist, self.out, self.error,
                            _no_prompt)
        command.execute()
        command.execute_post_archive_actions()

        result = "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {} Foo id:1\n".format(self.today)

        self.assertTrue(self.todolist.dirty)
        self.assertTrue(self.todolist.todo(1).is_completed())
        self.assertFalse(self.todolist.todo(2).is_completed())
        self.assertFalse(self.todolist.todo(3).is_completed())
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
コード例 #46
0
    def test_do_subtasks1(self):
        command = DoCommand(["1"], self.todolist, self.out, self.error,
                            _yes_prompt)
        command.execute()
        command.execute_post_archive_actions()

        result = "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {today} Bar p:1\nCompleted: x {today} Baz p:1\nCompleted: x {today} Foo id:1\n".format(today=self.today)

        for number in [1, 2, 3]:
            self.assertTrue(self.todolist.todo(number).is_completed())

        self.assertTrue(self.todolist.dirty)
        self.assertFalse(self.todolist.todo(4).is_completed())
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
コード例 #47
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_subtasks_force2(self):
        prompt_shown = False

        def prompt(p_prompt):
            global prompt_shown
            prompt_shown = True

        command = DoCommand(["--force", "1"], self.todolist, self.out,
                            self.error, prompt)
        command.execute()
        command.execute_post_archive_actions()

        self.assertFalse(prompt_shown)
        self.assertEqual(self.errors, "")
        self.assertFalse(self.todolist.todo(2).is_completed())
コード例 #48
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date5(self):
        """
        Make sure that the new recurrence date is correct when a custom
        date is given.
        """
        command = DoCommand(["-d", self.yesterday, "4"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, """Completed: x {yesterday} Recurring! rec:1d
The following todo item(s) became active:
| 12| {today} Recurring! rec:1d due:{today}\n""".format(today=self.today, yesterday=self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #49
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date7(self):
        """
        When a custom date is set, strict recurrence must still hold on to the
        due date as the offset.
        """
        command = DoCommand(["-s", "-d", self.yesterday, "8"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, """Completed: x {yesterday} Strict due:2014-01-01 rec:1d
The following todo item(s) became active:
| 12| {today} Strict due:2014-01-02 rec:1d\n""".format(today=self.today, yesterday=self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #50
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_subtasks1(self):
        command = DoCommand(["1"], self.todolist, self.out, self.error,
                            _yes_prompt)
        command.execute()
        command.execute_post_archive_actions()

        result = "|  2| Bar p:1\n|  3| Baz p:1\nCompleted: x {today} Bar p:1\nCompleted: x {today} Baz p:1\nCompleted: x {today} Foo id:1\n".format(today=self.today)

        for number in [1, 2, 3]:
            self.assertTrue(self.todolist.todo(number).is_completed())

        self.assertTrue(self.todolist.dirty)
        self.assertFalse(self.todolist.todo(4).is_completed())
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
コード例 #51
0
    def test_do_custom_date5(self):
        """
        Make sure that the new recurrence date is correct when a custom
        date is given.
        """
        command = DoCommand(["-d", self.yesterday, "4"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, """Completed: x {yesterday} Recurring! rec:1d
The following todo item(s) became active:
| 12| {today} Recurring! rec:1d due:{today}\n""".format(today=self.today, yesterday=self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #52
0
    def test_do_custom_date7(self):
        """
        When a custom date is set, strict recurrence must still hold on to the
        due date as the offset.
        """
        command = DoCommand(["-s", "-d", self.yesterday, "8"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, """Completed: x {yesterday} Strict due:2014-01-01 rec:1d
The following todo item(s) became active:
| 12| {today} Strict due:2014-01-02 rec:1d\n""".format(today=self.today, yesterday=self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #53
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_activated_todos1(self):
        command = DoCommand(["2"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        first_output = "Completed: x {} Bar p:1\n".format(self.today)

        self.assertEqual(self.output, first_output)
        self.assertEqual(self.errors, "")

        command = DoCommand(["3"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output, first_output + "Completed: x {} Baz p:1\nThe following todo item(s) became active:\n|  1| Foo id:1\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #54
0
ファイル: test_do_command.py プロジェクト: rcraggs/topydo
    def test_do_custom_date6(self):
        """
        When a custom date is set, strict recurrence must still hold on to the
        due date as the offset. This todo item however, has no due date, then
        the completion date must be used as an offset.
        """
        command = DoCommand(["-s", "-d", self.yesterday, "4"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, """Completed: x {yesterday} Recurring! rec:1d
The following todo item(s) became active:
| 12| {today} Recurring! rec:1d due:{today}\n""".format(today=self.today, yesterday=self.yesterday))
        self.assertEqual(self.errors, "")
コード例 #55
0
    def test_activated_todos1(self):
        command = DoCommand(["2"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        first_output = "Completed: x {} Bar p:1\n".format(self.today)

        self.assertEqual(self.output, first_output)
        self.assertEqual(self.errors, "")

        command = DoCommand(["3"], self.todolist, self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertEqual(self.output, first_output + "Completed: x {} Baz p:1\nThe following todo item(s) became active:\n|  1| Foo id:1\n".format(self.today))
        self.assertEqual(self.errors, "")
コード例 #56
0
    def test_do_custom_date6(self):
        """
        When a custom date is set, strict recurrence must still hold on to the
        due date as the offset. This todo item however, has no due date, then
        the completion date must be used as an offset.
        """
        command = DoCommand(["-s", "-d", self.yesterday, "4"], self.todolist,
                            self.out, self.error)
        command.execute()
        command.execute_post_archive_actions()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, """Completed: x {yesterday} Recurring! rec:1d
The following todo item(s) became active:
| 12| {today} Recurring! rec:1d due:{today}\n""".format(today=self.today, yesterday=self.yesterday))
        self.assertEqual(self.errors, "")