本文整理汇总了Python中topydo.commands.DoCommand.DoCommand类的典型用法代码示例。如果您正苦于以下问题:Python DoCommand类的具体用法?Python DoCommand怎么用?Python DoCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DoCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multi_do4
def test_multi_do4(self):
command = DoCommand(["99", "3"], self.todolist, self.out, self.error,
_no_prompt)
command.execute()
self.assertFalse(self.todolist.todo(3).is_completed())
self.assertEqual(self.errors, "Invalid todo number given: 99.\n")
示例2: test_do_custom_date3
def test_do_custom_date3(self):
command = DoCommand(["--date=2014-11-18", "3"], self.todolist, self.out, self.error)
command.execute()
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n")
self.assertEqual(self.errors, "")
示例3: test_empty
def test_empty(self):
command = DoCommand([], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n")
示例4: _recurrence_helper
def _recurrence_helper(self, p_flags):
command = DoCommand(p_flags, self.todolist, self.out, self.error)
command.execute()
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.errors, "")
self.assertEqual(self.todolist.count(), 12)
示例5: test_invalid3
def test_invalid3(self):
command = DoCommand(["01"], self.todolist, self.out, self.error, _yes_prompt)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n")
示例6: test_help
def test_help(self):
command = DoCommand(["help"], self.todolist, self.out, self.error)
command.execute()
self.assertEqual(self.output, "")
self.assertEqual(self.errors,
command.usage() + "\n\n" + command.help() + "\n")
示例7: test_do_custom_date4
def test_do_custom_date4(self):
command = DoCommand(["-d", "foo", "3"], self.todolist, self.out, self.error)
command.execute()
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.output, "Completed: x {} Baz p:1\n".format(self.today))
self.assertEqual(self.errors, "")
示例8: test_invalid2
def test_invalid2(self):
command = DoCommand(["AAA"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n")
示例9: test_multi_do6
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()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.errors, u("Invalid todo number given: Fo\u00d3B\u0105r.\n"))
示例10: test_invalid_recurrence
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()
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")
示例11: test_expr_do2
def test_expr_do2(self):
command = DoCommand(["-e", "@test", "due:2015-06-03"], self.todolist, self.out, self.error, None)
command.execute()
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.output, "Completed: x {} a @test with due:2015-06-03\n".format(self.today))
self.assertEqual(self.errors, "")
示例12: test_expr_do3
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)
示例13: test_activated_todos2
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, "")
示例14: test_expr_do4
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()
self.assertFalse(self.todolist.dirty)
示例15: test_do_custom_date2
def test_do_custom_date2(self):
command = DoCommand(["-d", "2014-11-18", "1"], self.todolist, self.out, self.error, _yes_prompt)
command.execute()
self.assertTrue(self.todolist.is_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, "")