本文整理汇总了Python中topydo.commands.PostponeCommand.PostponeCommand类的典型用法代码示例。如果您正苦于以下问题:Python PostponeCommand类的具体用法?Python PostponeCommand怎么用?Python PostponeCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PostponeCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_postpone12
def test_postpone12(self):
command = PostponeCommand(["1"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n")
示例2: test_postpone11
def test_postpone11(self):
command = PostponeCommand(["A", "foo"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n")
示例3: test_postpone19
def test_postpone19(self):
command = PostponeCommand(["Zoo", "99", "123", "1w"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given: Zoo.\nInvalid todo number given: 99.\nInvalid todo number given: 123.\n")
示例4: test_expr_postpone4
def test_expr_postpone4(self):
""" Don't postpone unrelevant todo items. """
command = PostponeCommand(["-e", "FutureStart", "1w"], self.todolist,
self.out, self.error, None)
command.execute()
self.assertFalse(self.todolist.dirty)
示例5: test_postpone17
def test_postpone17(self):
command = PostponeCommand(["1", "2", "3"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid date pattern given.\n")
示例6: test_help
def test_help(self):
command = PostponeCommand(["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_postpone20
def test_postpone20(self):
""" Throw an error with invalid argument containing special characters. """
command = PostponeCommand([u("Fo\u00d3B\u0105r"), "Bar", "1d"], self.todolist, self.out, self.error, None)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.output, "")
self.assertEqual(self.errors, u("Invalid todo number given: Fo\u00d3B\u0105r.\n"))
示例8: test_postpone15
def test_postpone15(self):
command = PostponeCommand(["Foo", "2", "1w"], self.todolist, self.out, self.error)
command.execute()
due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.output, "| 1| Foo due:{}\n| 2| Bar due:{}\n".format(due.isoformat(), due.isoformat()))
self.assertEqual(self.errors, "")
示例9: test_postpone6
def test_postpone6(self):
command = PostponeCommand(["4", "1w"], self.todolist, self.out, self.error)
command.execute()
due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.output, "| 4| Past due:{}\n".format(due.isoformat()))
self.assertEqual(self.errors, "")
示例10: test_postpone22
def test_postpone22(self):
"""
Todo item has an invalid start date.
"""
command = PostponeCommand(["8", "1d"], self.todolist, self.out, self.error)
command.execute()
self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 8| InvalidStartDate t:2017-06-31 due:{}\n".format(self.future.isoformat()))
self.assertEqual(self.errors, "")
示例11: test_postpone21
def test_postpone21(self):
"""
Show an error when a todo item has an invalid due date.
"""
command = PostponeCommand(["7", "1d"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Postponing todo item failed: invalid due date.\n")
示例12: test_expr_postpone1
def test_expr_postpone1(self):
command = PostponeCommand(["-e", "due:tod", "2w"], self.todolist, self.out, self.error, None)
command.execute()
due = self.today + timedelta(14)
result = "| 2| Bar due:{d}\n| 3| Baz due:{d} t:{s}\n".format(d=due.isoformat(), s=self.start.isoformat())
self.assertTrue(self.todolist.is_dirty())
self.assertEqual(self.output, result)
self.assertEqual(self.errors, "")
示例13: test_postpone23
def test_postpone23(self):
"""
Todo item has an invalid start date.
"""
command = PostponeCommand(["-s", "8", "1d"], self.todolist, self.out, self.error)
command.execute()
self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 8| InvalidStartDate t:2017-06-31 due:{}\n".format(self.future.isoformat()))
self.assertEqual(self.errors, "Warning: todo item has no (valid) start date, therefore it was not adjusted.\n")
示例14: test_postpone04
def test_postpone04(self):
command = PostponeCommand(["3", "1w"], self.todolist, self.out,
self.error)
command.execute()
due = self.today + timedelta(7)
self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 3| Baz due:{} t:{}\n".format(due.isoformat(), self.start.isoformat()))
self.assertEqual(self.errors, "")
示例15: test_postpone7
def test_postpone7(self):
command = PostponeCommand(["5", "1w"], self.todolist, self.out, self.error)
command.execute()
due = self.future + timedelta(7)
self.assertTrue(self.todolist.is_dirty())
# pylint: disable=E1103
self.assertEqual(self.output, "| 5| Future due:{} t:{}\n".format(due.isoformat(), self.future_start.isoformat()))
self.assertEqual(self.errors, "")