Commit 9b537b02 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Make dirty a property of TodoListBase

parent fc154914
...@@ -30,8 +30,8 @@ class ArchiveCommandTest(CommandTest): ...@@ -30,8 +30,8 @@ class ArchiveCommandTest(CommandTest):
command = ArchiveCommand(todolist, archive) command = ArchiveCommand(todolist, archive)
command.execute() command.execute()
self.assertTrue(todolist.is_dirty()) self.assertTrue(todolist.dirty)
self.assertTrue(archive.is_dirty()) self.assertTrue(archive.dirty)
self.assertEqual(todolist.print_todos(), "x Not complete\n(C) Active") self.assertEqual(todolist.print_todos(), "x Not complete\n(C) Active")
self.assertEqual(archive.print_todos(), "x 2014-10-19 Complete\nx 2014-10-20 Another one complete") self.assertEqual(archive.print_todos(), "x 2014-10-19 Complete\nx 2014-10-20 Another one complete")
......
...@@ -48,7 +48,7 @@ class DeleteCommandTest(CommandTest): ...@@ -48,7 +48,7 @@ class DeleteCommandTest(CommandTest):
_no_prompt) _no_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.todo(1).source(), "Bar") self.assertEqual(self.todolist.todo(1).source(), "Bar")
self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n") self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -58,7 +58,7 @@ class DeleteCommandTest(CommandTest): ...@@ -58,7 +58,7 @@ class DeleteCommandTest(CommandTest):
_no_prompt) _no_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.todo(1).source(), "Bar") self.assertEqual(self.todolist.todo(1).source(), "Bar")
self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n") self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -68,7 +68,7 @@ class DeleteCommandTest(CommandTest): ...@@ -68,7 +68,7 @@ class DeleteCommandTest(CommandTest):
_yes_prompt) _yes_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.count(), 2) self.assertEqual(self.todolist.count(), 2)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 2| Bar p:1\nRemoved: Bar\nRemoved: Foo\n") "| 2| Bar p:1\nRemoved: Bar\nRemoved: Foo\n")
...@@ -79,7 +79,7 @@ class DeleteCommandTest(CommandTest): ...@@ -79,7 +79,7 @@ class DeleteCommandTest(CommandTest):
self.error, _yes_prompt) self.error, _yes_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.count(), 3) # force won't delete subtasks self.assertEqual(self.todolist.count(), 3) # force won't delete subtasks
self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n") self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -89,7 +89,7 @@ class DeleteCommandTest(CommandTest): ...@@ -89,7 +89,7 @@ class DeleteCommandTest(CommandTest):
self.error, _yes_prompt) self.error, _yes_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.count(), 3) # force won't delete subtasks self.assertEqual(self.todolist.count(), 3) # force won't delete subtasks
self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n") self.assertEqual(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -98,7 +98,7 @@ class DeleteCommandTest(CommandTest): ...@@ -98,7 +98,7 @@ class DeleteCommandTest(CommandTest):
command = DeleteCommand(["2"], self.todolist, self.out, self.error) command = DeleteCommand(["2"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.todo(1).source(), "Foo") self.assertEqual(self.todolist.todo(1).source(), "Foo")
self.assertEqual(self.output, "Removed: Bar p:1\nThe following todo item(s) became active:\n| 1| Foo\n") self.assertEqual(self.output, "Removed: Bar p:1\nThe following todo item(s) became active:\n| 1| Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -107,7 +107,7 @@ class DeleteCommandTest(CommandTest): ...@@ -107,7 +107,7 @@ class DeleteCommandTest(CommandTest):
command = DeleteCommand(["99"], self.todolist, self.out, self.error) command = DeleteCommand(["99"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -115,7 +115,7 @@ class DeleteCommandTest(CommandTest): ...@@ -115,7 +115,7 @@ class DeleteCommandTest(CommandTest):
command = DeleteCommand(["A"], self.todolist, self.out, self.error) command = DeleteCommand(["A"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -159,7 +159,7 @@ class DeleteCommandTest(CommandTest): ...@@ -159,7 +159,7 @@ class DeleteCommandTest(CommandTest):
self.error, _yes_prompt) self.error, _yes_prompt)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given: 99.\n") self.assertEqual(self.errors, "Invalid todo number given: 99.\n")
...@@ -169,7 +169,7 @@ class DeleteCommandTest(CommandTest): ...@@ -169,7 +169,7 @@ class DeleteCommandTest(CommandTest):
self.error, _yes_prompt) self.error, _yes_prompt)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: A.\n") self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: A.\n")
...@@ -181,7 +181,7 @@ class DeleteCommandTest(CommandTest): ...@@ -181,7 +181,7 @@ class DeleteCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, self.assertEqual(self.errors,
u"Invalid todo number given: Fo\u00d3B\u0105r.\n") u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
...@@ -193,7 +193,7 @@ class DeleteCommandTest(CommandTest): ...@@ -193,7 +193,7 @@ class DeleteCommandTest(CommandTest):
result = "Removed: a @test with due:2015-06-03\nRemoved: a @test with +project\n" result = "Removed: a @test with due:2015-06-03\nRemoved: a @test with +project\n"
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.count(), 2) self.assertEqual(self.todolist.count(), 2)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -203,7 +203,7 @@ class DeleteCommandTest(CommandTest): ...@@ -203,7 +203,7 @@ class DeleteCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Removed: a @test with due:2015-06-03\n") self.assertEqual(self.output, "Removed: a @test with due:2015-06-03\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -212,7 +212,7 @@ class DeleteCommandTest(CommandTest): ...@@ -212,7 +212,7 @@ class DeleteCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_del4(self): def test_expr_del4(self):
""" Remove only relevant todo items. """ """ Remove only relevant todo items. """
...@@ -222,7 +222,7 @@ class DeleteCommandTest(CommandTest): ...@@ -222,7 +222,7 @@ class DeleteCommandTest(CommandTest):
result = "Foo" result = "Foo"
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.count(), 1) self.assertEqual(self.todolist.count(), 1)
self.assertEqual(self.todolist.print_todos(), result) self.assertEqual(self.todolist.print_todos(), result)
...@@ -232,14 +232,14 @@ class DeleteCommandTest(CommandTest): ...@@ -232,14 +232,14 @@ class DeleteCommandTest(CommandTest):
self.error, _yes_prompt) self.error, _yes_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.count(), 0) self.assertEqual(self.todolist.count(), 0)
def test_empty(self): def test_empty(self):
command = DeleteCommand([], self.todolist, self.out, self.error) command = DeleteCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
......
...@@ -40,7 +40,7 @@ class DepCommandTest(CommandTest): ...@@ -40,7 +40,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(4).has_tag('p', '1')) self.assertTrue(self.todolist.todo(4).has_tag('p', '1'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -50,7 +50,7 @@ class DepCommandTest(CommandTest): ...@@ -50,7 +50,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(4).has_tag('p', '1')) self.assertTrue(self.todolist.todo(4).has_tag('p', '1'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -60,7 +60,7 @@ class DepCommandTest(CommandTest): ...@@ -60,7 +60,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -69,7 +69,7 @@ class DepCommandTest(CommandTest): ...@@ -69,7 +69,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -77,7 +77,7 @@ class DepCommandTest(CommandTest): ...@@ -77,7 +77,7 @@ class DepCommandTest(CommandTest):
command = DepCommand(["add", "1"], self.todolist, self.out, self.error) command = DepCommand(["add", "1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -86,7 +86,7 @@ class DepCommandTest(CommandTest): ...@@ -86,7 +86,7 @@ class DepCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(4).has_tag('p', '1')) self.assertTrue(self.todolist.todo(4).has_tag('p', '1'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -96,7 +96,7 @@ class DepCommandTest(CommandTest): ...@@ -96,7 +96,7 @@ class DepCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(1).has_tag('p', '2')) self.assertTrue(self.todolist.todo(1).has_tag('p', '2'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -106,7 +106,7 @@ class DepCommandTest(CommandTest): ...@@ -106,7 +106,7 @@ class DepCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(1).has_tag('p', '2')) self.assertTrue(self.todolist.todo(1).has_tag('p', '2'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -116,7 +116,7 @@ class DepCommandTest(CommandTest): ...@@ -116,7 +116,7 @@ class DepCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(4).has_tag('p', '1')) self.assertTrue(self.todolist.todo(4).has_tag('p', '1'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -129,7 +129,7 @@ class DepCommandTest(CommandTest): ...@@ -129,7 +129,7 @@ class DepCommandTest(CommandTest):
command = DepCommand(p_args, self.todolist, self.out, self.error) command = DepCommand(p_args, self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(1).has_tag('id', '1')) self.assertTrue(self.todolist.todo(1).has_tag('id', '1'))
self.assertFalse(self.todolist.todo(3).has_tag('p', '1')) self.assertFalse(self.todolist.todo(3).has_tag('p', '1'))
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
...@@ -152,7 +152,7 @@ class DepCommandTest(CommandTest): ...@@ -152,7 +152,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -161,7 +161,7 @@ class DepCommandTest(CommandTest): ...@@ -161,7 +161,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -169,7 +169,7 @@ class DepCommandTest(CommandTest): ...@@ -169,7 +169,7 @@ class DepCommandTest(CommandTest):
command = DepCommand(["rm", "1"], self.todolist, self.out, self.error) command = DepCommand(["rm", "1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -178,7 +178,7 @@ class DepCommandTest(CommandTest): ...@@ -178,7 +178,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 2| Bar p:1\n| 3| Baz p:1\n") self.assertEqual(self.output, "| 2| Bar p:1\n| 3| Baz p:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -187,7 +187,7 @@ class DepCommandTest(CommandTest): ...@@ -187,7 +187,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -196,7 +196,7 @@ class DepCommandTest(CommandTest): ...@@ -196,7 +196,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| Foo id:1\n") self.assertEqual(self.output, "| 1| Foo id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -205,7 +205,7 @@ class DepCommandTest(CommandTest): ...@@ -205,7 +205,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -213,7 +213,7 @@ class DepCommandTest(CommandTest): ...@@ -213,7 +213,7 @@ class DepCommandTest(CommandTest):
command = DepCommand(["ls", "1"], self.todolist, self.out, self.error) command = DepCommand(["ls", "1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -221,7 +221,7 @@ class DepCommandTest(CommandTest): ...@@ -221,7 +221,7 @@ class DepCommandTest(CommandTest):
command = DepCommand(["ls"], self.todolist, self.out, self.error) command = DepCommand(["ls"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -230,7 +230,7 @@ class DepCommandTest(CommandTest): ...@@ -230,7 +230,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -239,7 +239,7 @@ class DepCommandTest(CommandTest): ...@@ -239,7 +239,7 @@ class DepCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertFalse(self.errors) self.assertFalse(self.errors)
self.assertFalse(self.todolist.todo(5).has_tag('p', '99')) self.assertFalse(self.todolist.todo(5).has_tag('p', '99'))
...@@ -256,7 +256,7 @@ class DepCommandTest(CommandTest): ...@@ -256,7 +256,7 @@ class DepCommandTest(CommandTest):
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_no_subsubcommand(self): def test_no_subsubcommand(self):
command = DepCommand([], self.todolist, self.out, self.error) command = DepCommand([], self.todolist, self.out, self.error)
...@@ -264,7 +264,7 @@ class DepCommandTest(CommandTest): ...@@ -264,7 +264,7 @@ class DepCommandTest(CommandTest):
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_help(self): def test_help(self):
command = DepCommand(["help"], self.todolist, self.out, self.error) command = DepCommand(["help"], self.todolist, self.out, self.error)
......
...@@ -39,7 +39,7 @@ class DepriCommandTest(CommandTest): ...@@ -39,7 +39,7 @@ class DepriCommandTest(CommandTest):
command = DepriCommand(["1"], self.todolist, self.out, self.error) command = DepriCommand(["1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.todo(1).priority(), None) self.assertEqual(self.todolist.todo(1).priority(), None)
self.assertEqual(self.output, "Priority removed.\n| 1| Foo\n") self.assertEqual(self.output, "Priority removed.\n| 1| Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -48,7 +48,7 @@ class DepriCommandTest(CommandTest): ...@@ -48,7 +48,7 @@ class DepriCommandTest(CommandTest):
command = DepriCommand(["2"], self.todolist, self.out, self.error) command = DepriCommand(["2"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.todolist.todo(2).priority(), None) self.assertEqual(self.todolist.todo(2).priority(), None)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -57,7 +57,7 @@ class DepriCommandTest(CommandTest): ...@@ -57,7 +57,7 @@ class DepriCommandTest(CommandTest):
command = DepriCommand(["Foo"], self.todolist, self.out, self.error) command = DepriCommand(["Foo"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.todo(1).priority(), None) self.assertEqual(self.todolist.todo(1).priority(), None)
self.assertEqual(self.output, "Priority removed.\n| 1| Foo\n") self.assertEqual(self.output, "Priority removed.\n| 1| Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -67,7 +67,7 @@ class DepriCommandTest(CommandTest): ...@@ -67,7 +67,7 @@ class DepriCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.todo(1).priority(), None) self.assertEqual(self.todolist.todo(1).priority(), None)
self.assertEqual(self.todolist.todo(3).priority(), None) self.assertEqual(self.todolist.todo(3).priority(), None)
self.assertEqual(self.output, "Priority removed.\n| 1| Foo\nPriority removed.\n| 3| Baz\n") self.assertEqual(self.output, "Priority removed.\n| 1| Foo\nPriority removed.\n| 3| Baz\n")
...@@ -80,7 +80,7 @@ class DepriCommandTest(CommandTest): ...@@ -80,7 +80,7 @@ class DepriCommandTest(CommandTest):
result = "Priority removed.\n| 4| a @test with due:2015-06-03\nPriority removed.\n| 5| a @test with +project p:1\n" result = "Priority removed.\n| 4| a @test with due:2015-06-03\nPriority removed.\n| 5| a @test with +project p:1\n"
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -91,7 +91,7 @@ class DepriCommandTest(CommandTest): ...@@ -91,7 +91,7 @@ class DepriCommandTest(CommandTest):
result = "Priority removed.\n| 4| a @test with due:2015-06-03\n" result = "Priority removed.\n| 4| a @test with due:2015-06-03\n"
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -100,7 +100,7 @@ class DepriCommandTest(CommandTest): ...@@ -100,7 +100,7 @@ class DepriCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_depri4(self): def test_expr_depri4(self):
""" Don't remove priority from unrelevant todo items. """ """ Don't remove priority from unrelevant todo items. """
...@@ -108,7 +108,7 @@ class DepriCommandTest(CommandTest): ...@@ -108,7 +108,7 @@ class DepriCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_depri5(self): def test_expr_depri5(self):
""" Force unprioritizing unrelevant items with additional -x flag. """ """ Force unprioritizing unrelevant items with additional -x flag. """
...@@ -116,7 +116,7 @@ class DepriCommandTest(CommandTest): ...@@ -116,7 +116,7 @@ class DepriCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Priority removed.\n| 6| Bax id:1\n") self.assertEqual(self.output, "Priority removed.\n| 6| Bax id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -124,7 +124,7 @@ class DepriCommandTest(CommandTest): ...@@ -124,7 +124,7 @@ class DepriCommandTest(CommandTest):
command = DepriCommand(["99"], self.todolist, self.out, self.error) command = DepriCommand(["99"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -133,7 +133,7 @@ class DepriCommandTest(CommandTest): ...@@ -133,7 +133,7 @@ class DepriCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given: 99.\n") self.assertEqual(self.errors, "Invalid todo number given: 99.\n")
...@@ -142,7 +142,7 @@ class DepriCommandTest(CommandTest): ...@@ -142,7 +142,7 @@ class DepriCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: FooBar.\n") self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: FooBar.\n")
...@@ -154,7 +154,7 @@ class DepriCommandTest(CommandTest): ...@@ -154,7 +154,7 @@ class DepriCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, self.assertEqual(self.errors,
u"Invalid todo number given: Fo\u00d3B\u0105r.\n") u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
...@@ -163,7 +163,7 @@ class DepriCommandTest(CommandTest): ...@@ -163,7 +163,7 @@ class DepriCommandTest(CommandTest):
command = DepriCommand([], self.todolist, self.out, self.error) command = DepriCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
......
...@@ -61,7 +61,7 @@ class DoCommandTest(CommandTest): ...@@ -61,7 +61,7 @@ class DoCommandTest(CommandTest):
_no_prompt) _no_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(3).is_completed()) self.assertTrue(self.todolist.todo(3).is_completed())
self.assertEqual(self.output, self.assertEqual(self.output,
"Completed: x {} Baz p:1\n".format(self.today)) "Completed: x {} Baz p:1\n".format(self.today))
...@@ -77,7 +77,7 @@ class DoCommandTest(CommandTest): ...@@ -77,7 +77,7 @@ class DoCommandTest(CommandTest):
for number in [1, 2, 3]: for number in [1, 2, 3]:
self.assertTrue(self.todolist.todo(number).is_completed()) self.assertTrue(self.todolist.todo(number).is_completed())
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertFalse(self.todolist.todo(4).is_completed()) self.assertFalse(self.todolist.todo(4).is_completed())
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -89,7 +89,7 @@ class DoCommandTest(CommandTest): ...@@ -89,7 +89,7 @@ class DoCommandTest(CommandTest):
result = "| 2| Bar p:1\n| 3| Baz p:1\nCompleted: x {} Foo id:1\n".format(self.today) result = "| 2| Bar p:1\n| 3| Baz p:1\nCompleted: x {} Foo id:1\n".format(self.today)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(1).is_completed()) self.assertTrue(self.todolist.todo(1).is_completed())
self.assertFalse(self.todolist.todo(2).is_completed()) self.assertFalse(self.todolist.todo(2).is_completed())
self.assertFalse(self.todolist.todo(3).is_completed()) self.assertFalse(self.todolist.todo(3).is_completed())
...@@ -130,7 +130,7 @@ class DoCommandTest(CommandTest): ...@@ -130,7 +130,7 @@ class DoCommandTest(CommandTest):
command = DoCommand(p_flags, self.todolist, self.out, self.error) command = DoCommand(p_flags, self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertEqual(self.todolist.count(), 12) self.assertEqual(self.todolist.count(), 12)
...@@ -162,7 +162,7 @@ class DoCommandTest(CommandTest): ...@@ -162,7 +162,7 @@ class DoCommandTest(CommandTest):
command = DoCommand(["99"], self.todolist, self.out, self.error) command = DoCommand(["99"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -170,7 +170,7 @@ class DoCommandTest(CommandTest): ...@@ -170,7 +170,7 @@ class DoCommandTest(CommandTest):
command = DoCommand(["AAA"], self.todolist, self.out, self.error) command = DoCommand(["AAA"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -179,7 +179,7 @@ class DoCommandTest(CommandTest): ...@@ -179,7 +179,7 @@ class DoCommandTest(CommandTest):
_yes_prompt) _yes_prompt)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -209,7 +209,7 @@ class DoCommandTest(CommandTest): ...@@ -209,7 +209,7 @@ class DoCommandTest(CommandTest):
command = DoCommand(["5"], self.todolist, self.out, self.error) command = DoCommand(["5"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.todolist.todo(5).completion_date(), self.assertEqual(self.todolist.todo(5).completion_date(),
date(2014, 10, 18)) date(2014, 10, 18))
self.assertFalse(self.output) self.assertFalse(self.output)
...@@ -219,7 +219,7 @@ class DoCommandTest(CommandTest): ...@@ -219,7 +219,7 @@ class DoCommandTest(CommandTest):
command = DoCommand(["baz"], self.todolist, self.out, self.error) command = DoCommand(["baz"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertTrue(self.todolist.todo(3).is_completed()) self.assertTrue(self.todolist.todo(3).is_completed())
self.assertEqual(self.output, self.assertEqual(self.output,
"Completed: x {} Baz p:1\n".format(self.today)) "Completed: x {} Baz p:1\n".format(self.today))
...@@ -230,7 +230,7 @@ class DoCommandTest(CommandTest): ...@@ -230,7 +230,7 @@ class DoCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n") self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -239,7 +239,7 @@ class DoCommandTest(CommandTest): ...@@ -239,7 +239,7 @@ class DoCommandTest(CommandTest):
self.error, _yes_prompt) self.error, _yes_prompt)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) 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.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, "") self.assertEqual(self.errors, "")
...@@ -248,7 +248,7 @@ class DoCommandTest(CommandTest): ...@@ -248,7 +248,7 @@ class DoCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n") self.assertEqual(self.output, "Completed: x 2014-11-18 Baz p:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -257,7 +257,7 @@ class DoCommandTest(CommandTest): ...@@ -257,7 +257,7 @@ class DoCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"Completed: x {} Baz p:1\n".format(self.today)) "Completed: x {} Baz p:1\n".format(self.today))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -271,7 +271,7 @@ class DoCommandTest(CommandTest): ...@@ -271,7 +271,7 @@ class DoCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 12| {today} Recurring! rec:1d due:{today}\nCompleted: x {yesterday} Recurring! rec:1d\n".format(today=self.today, yesterday=self.yesterday)) self.assertEqual(self.output, "| 12| {today} Recurring! rec:1d due:{today}\nCompleted: x {yesterday} Recurring! rec:1d\n".format(today=self.today, yesterday=self.yesterday))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -285,7 +285,7 @@ class DoCommandTest(CommandTest): ...@@ -285,7 +285,7 @@ class DoCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 12| {today} Recurring! rec:1d due:{today}\nCompleted: x {yesterday} Recurring! rec:1d\n".format(today=self.today, yesterday=self.yesterday)) self.assertEqual(self.output, "| 12| {today} Recurring! rec:1d due:{today}\nCompleted: x {yesterday} Recurring! rec:1d\n".format(today=self.today, yesterday=self.yesterday))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -298,7 +298,7 @@ class DoCommandTest(CommandTest): ...@@ -298,7 +298,7 @@ class DoCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 12| {today} Strict due:2014-01-02 rec:1d\nCompleted: x {yesterday} Strict due:2014-01-01 rec:1d\n".format(today=self.today, yesterday=self.yesterday)) self.assertEqual(self.output, "| 12| {today} Strict due:2014-01-02 rec:1d\nCompleted: x {yesterday} Strict due:2014-01-01 rec:1d\n".format(today=self.today, yesterday=self.yesterday))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -310,7 +310,7 @@ class DoCommandTest(CommandTest): ...@@ -310,7 +310,7 @@ class DoCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"Completed: x {} Baz p:1\n".format(self.yesterday)) "Completed: x {} Baz p:1\n".format(self.yesterday))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -323,7 +323,7 @@ class DoCommandTest(CommandTest): ...@@ -323,7 +323,7 @@ class DoCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"Completed: x {} Baz p:1\n".format(self.yesterday)) "Completed: x {} Baz p:1\n".format(self.yesterday))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -385,7 +385,7 @@ class DoCommandTest(CommandTest): ...@@ -385,7 +385,7 @@ class DoCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.errors, self.assertEqual(self.errors,
u"Invalid todo number given: Fo\u00d3B\u0105r.\n") u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
...@@ -394,7 +394,7 @@ class DoCommandTest(CommandTest): ...@@ -394,7 +394,7 @@ class DoCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Completed: x {t} a @test with due:2015-06-03\nCompleted: x {t} a @test with +project\n".format(t=self.today)) self.assertEqual(self.output, "Completed: x {t} a @test with due:2015-06-03\nCompleted: x {t} a @test with +project\n".format(t=self.today))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -403,7 +403,7 @@ class DoCommandTest(CommandTest): ...@@ -403,7 +403,7 @@ class DoCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) 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.output, "Completed: x {} a @test with due:2015-06-03\n".format(self.today))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -412,7 +412,7 @@ class DoCommandTest(CommandTest): ...@@ -412,7 +412,7 @@ class DoCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_do4(self): def test_expr_do4(self):
""" Don't do anything with unrelevant todo items. """ """ Don't do anything with unrelevant todo items. """
...@@ -420,7 +420,7 @@ class DoCommandTest(CommandTest): ...@@ -420,7 +420,7 @@ class DoCommandTest(CommandTest):
None) None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_do5(self): def test_expr_do5(self):
""" Force marking unrelevant items as done with additional -x flag. """ """ Force marking unrelevant items as done with additional -x flag. """
...@@ -430,7 +430,7 @@ class DoCommandTest(CommandTest): ...@@ -430,7 +430,7 @@ class DoCommandTest(CommandTest):
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) 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.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -450,7 +450,7 @@ class DoCommandTest(CommandTest): ...@@ -450,7 +450,7 @@ class DoCommandTest(CommandTest):
command = DoCommand([], self.todolist, self.out, self.error) command = DoCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
......
...@@ -56,7 +56,7 @@ class EditCommandTest(CommandTest): ...@@ -56,7 +56,7 @@ class EditCommandTest(CommandTest):
command.execute() command.execute()
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.todolist.print_todos(), u"Bar p:1 @test\nBaz @test\nFo\u00f3B\u0105\u017a\nFoo id:1") self.assertEqual(self.todolist.print_todos(), u"Bar p:1 @test\nBaz @test\nFo\u00f3B\u0105\u017a\nFoo id:1")
@mock.patch('topydo.commands.EditCommand._is_edited') @mock.patch('topydo.commands.EditCommand._is_edited')
...@@ -72,7 +72,7 @@ class EditCommandTest(CommandTest): ...@@ -72,7 +72,7 @@ class EditCommandTest(CommandTest):
None) None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertEqual(self.todolist.print_todos(), u"Foo id:1\nBaz @test\nFo\u00f3B\u0105\u017a\nLazy Cat") self.assertEqual(self.todolist.print_todos(), u"Foo id:1\nBaz @test\nFo\u00f3B\u0105\u017a\nLazy Cat")
...@@ -82,7 +82,7 @@ class EditCommandTest(CommandTest): ...@@ -82,7 +82,7 @@ class EditCommandTest(CommandTest):
None) None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
def test_edit04(self): def test_edit04(self):
...@@ -91,7 +91,7 @@ class EditCommandTest(CommandTest): ...@@ -91,7 +91,7 @@ class EditCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.errors, "Invalid todo number given: 5.\n") self.assertEqual(self.errors, "Invalid todo number given: 5.\n")
def test_edit05(self): def test_edit05(self):
...@@ -102,7 +102,7 @@ class EditCommandTest(CommandTest): ...@@ -102,7 +102,7 @@ class EditCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.errors, self.assertEqual(self.errors,
u"Invalid todo number given: Fo\u00d3B\u0105r.\n") u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
...@@ -119,7 +119,7 @@ class EditCommandTest(CommandTest): ...@@ -119,7 +119,7 @@ class EditCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertEqual(self.todolist.print_todos(), self.assertEqual(self.todolist.print_todos(),
u"Foo id:1\nBar p:1 @test\nBaz @test\nLazy Cat") u"Foo id:1\nBar p:1 @test\nBaz @test\nLazy Cat")
...@@ -137,7 +137,7 @@ class EditCommandTest(CommandTest): ...@@ -137,7 +137,7 @@ class EditCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.errors, "Editing aborted. Nothing to do.\n") self.assertEqual(self.errors, "Editing aborted. Nothing to do.\n")
self.assertEqual(self.todolist.print_todos(), u"Foo id:1\nBar p:1 @test\nBaz @test\nFo\u00f3B\u0105\u017a") self.assertEqual(self.todolist.print_todos(), u"Foo id:1\nBar p:1 @test\nBaz @test\nFo\u00f3B\u0105\u017a")
...@@ -158,7 +158,7 @@ class EditCommandTest(CommandTest): ...@@ -158,7 +158,7 @@ class EditCommandTest(CommandTest):
expected = u"| 3| Lazy Cat\n| 4| Lazy Dog\n" expected = u"| 3| Lazy Cat\n| 4| Lazy Dog\n"
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, expected) self.assertEqual(self.output, expected)
self.assertEqual(self.todolist.print_todos(), u"Foo id:1\nFo\u00f3B\u0105\u017a\nLazy Cat\nLazy Dog") self.assertEqual(self.todolist.print_todos(), u"Foo id:1\nFo\u00f3B\u0105\u017a\nLazy Cat\nLazy Dog")
......
...@@ -43,7 +43,7 @@ class ListCommandTest(CommandTest): ...@@ -43,7 +43,7 @@ class ListCommandTest(CommandTest):
command = ListCommand([""], self.todolist, self.out, self.error) command = ListCommand([""], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -52,7 +52,7 @@ class ListCommandTest(CommandTest): ...@@ -52,7 +52,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -61,7 +61,7 @@ class ListCommandTest(CommandTest): ...@@ -61,7 +61,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 3| (C) Baz @Context1 +Project1 key:value\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 3| (C) Baz @Context1 +Project1 key:value\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -69,7 +69,7 @@ class ListCommandTest(CommandTest): ...@@ -69,7 +69,7 @@ class ListCommandTest(CommandTest):
command = ListCommand(["-x"], self.todolist, self.out, self.error) command = ListCommand(["-x"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 3| (C) Baz @Context1 +Project1 key:value\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n| 6| x 2014-12-12 Completed but with date:2014-12-12\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 3| (C) Baz @Context1 +Project1 key:value\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n| 6| x 2014-12-12 Completed but with date:2014-12-12\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -78,7 +78,7 @@ class ListCommandTest(CommandTest): ...@@ -78,7 +78,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -87,7 +87,7 @@ class ListCommandTest(CommandTest): ...@@ -87,7 +87,7 @@ class ListCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 3| (C) Baz @Context1 +Project1 key:value\n| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n") self.assertEqual(self.output, "| 3| (C) Baz @Context1 +Project1 key:value\n| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -96,7 +96,7 @@ class ListCommandTest(CommandTest): ...@@ -96,7 +96,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -105,7 +105,7 @@ class ListCommandTest(CommandTest): ...@@ -105,7 +105,7 @@ class ListCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -114,7 +114,7 @@ class ListCommandTest(CommandTest): ...@@ -114,7 +114,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -124,7 +124,7 @@ class ListCommandTest(CommandTest): ...@@ -124,7 +124,7 @@ class ListCommandTest(CommandTest):
command = ListCommand(["project"], self.todolist, self.out, self.error) command = ListCommand(["project"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -135,7 +135,7 @@ class ListCommandTest(CommandTest): ...@@ -135,7 +135,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 3| (C) Baz @Context1 +Project1 key:value\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 3| (C) Baz @Context1 +Project1 key:value\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -144,7 +144,7 @@ class ListCommandTest(CommandTest): ...@@ -144,7 +144,7 @@ class ListCommandTest(CommandTest):
self.todolist, self.out, self.error) self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 3| (C) Baz @Context1 +Project1 key:value\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 6| x 2014-12-12 Completed but with date:2014-12-12\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 3| (C) Baz @Context1 +Project1 key:value\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 6| x 2014-12-12 Completed but with date:2014-12-12\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -154,7 +154,7 @@ class ListCommandTest(CommandTest): ...@@ -154,7 +154,7 @@ class ListCommandTest(CommandTest):
command = ListCommand([], self.todolist, self.out, self.error) command = ListCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, " | 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n | 4| (C) Drink beer @ home\n | 5| (C) 13 + 29 = 42\n | 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, " | 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n | 4| (C) Drink beer @ home\n | 5| (C) 13 + 29 = 42\n | 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -162,7 +162,7 @@ class ListCommandTest(CommandTest): ...@@ -162,7 +162,7 @@ class ListCommandTest(CommandTest):
command = ListCommand(["p:<10"], self.todolist, self.out, self.error) command = ListCommand(["p:<10"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -172,7 +172,7 @@ class ListCommandTest(CommandTest): ...@@ -172,7 +172,7 @@ class ListCommandTest(CommandTest):
command = ListCommand([], self.todolist, self.out, self.error) command = ListCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "|t5c| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n|wa5| (C) Drink beer @ home\n|z63| (C) 13 + 29 = 42\n|mfg| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "|t5c| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n|wa5| (C) Drink beer @ home\n|z63| (C) 13 + 29 = 42\n|mfg| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -181,7 +181,7 @@ class ListCommandTest(CommandTest): ...@@ -181,7 +181,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 3| (C) Baz @Context1 +Project1 key:value\n") "| 3| (C) Baz @Context1 +Project1 key:value\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -191,7 +191,7 @@ class ListCommandTest(CommandTest): ...@@ -191,7 +191,7 @@ class ListCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 6| x 2014-12-12 Completed but with date:2014-12-12\n") self.assertEqual(self.output, "| 6| x 2014-12-12 Completed but with date:2014-12-12\n")
def test_list19(self): def test_list19(self):
...@@ -202,7 +202,7 @@ class ListCommandTest(CommandTest): ...@@ -202,7 +202,7 @@ class ListCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 3| (C) Baz @Context1 +Project1 id:1 key:value\n| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n") self.assertEqual(self.output, "| 3| (C) Baz @Context1 +Project1 id:1 key:value\n| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -210,7 +210,7 @@ class ListCommandTest(CommandTest): ...@@ -210,7 +210,7 @@ class ListCommandTest(CommandTest):
command = ListCommand(["-f text"], self.todolist, self.out, self.error) command = ListCommand(["-f text"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -219,7 +219,7 @@ class ListCommandTest(CommandTest): ...@@ -219,7 +219,7 @@ class ListCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n") self.assertEqual(self.output, "| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -231,7 +231,7 @@ class ListCommandTest(CommandTest): ...@@ -231,7 +231,7 @@ class ListCommandTest(CommandTest):
command = ListCommand(["-x"], self.todolist, self.out, self.error) command = ListCommand(["-x"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, '| 1| Foo.\n') self.assertEqual(self.output, '| 1| Foo.\n')
def test_list31(self): def test_list31(self):
...@@ -406,7 +406,7 @@ class ListCommandUnicodeTest(CommandTest): ...@@ -406,7 +406,7 @@ class ListCommandUnicodeTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
expected = u"| 1| (C) And some sp\u00e9cial tag:\u25c4\n" expected = u"| 1| (C) And some sp\u00e9cial tag:\u25c4\n"
...@@ -420,7 +420,7 @@ class ListCommandJsonTest(CommandTest): ...@@ -420,7 +420,7 @@ class ListCommandJsonTest(CommandTest):
command = ListCommand(["-f", "json"], todolist, self.out, self.error) command = ListCommand(["-f", "json"], todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(todolist.is_dirty()) self.assertFalse(todolist.dirty)
jsontext = "" jsontext = ""
with codecs.open('test/data/ListCommandTest.json', 'r', with codecs.open('test/data/ListCommandTest.json', 'r',
...@@ -436,7 +436,7 @@ class ListCommandJsonTest(CommandTest): ...@@ -436,7 +436,7 @@ class ListCommandJsonTest(CommandTest):
command = ListCommand(["-f", "json"], todolist, self.out, self.error) command = ListCommand(["-f", "json"], todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(todolist.is_dirty()) self.assertFalse(todolist.dirty)
jsontext = "" jsontext = ""
with codecs.open('test/data/ListCommandUnicodeTest.json', 'r', with codecs.open('test/data/ListCommandUnicodeTest.json', 'r',
...@@ -466,7 +466,7 @@ class ListCommandIcalTest(CommandTest): ...@@ -466,7 +466,7 @@ class ListCommandIcalTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(todolist.is_dirty()) self.assertTrue(todolist.dirty)
icaltext = "" icaltext = ""
with codecs.open('test/data/ListCommandTest.ics', 'r', with codecs.open('test/data/ListCommandTest.ics', 'r',
...@@ -483,7 +483,7 @@ class ListCommandIcalTest(CommandTest): ...@@ -483,7 +483,7 @@ class ListCommandIcalTest(CommandTest):
command = ListCommand(["-f", "ical"], todolist, self.out, self.error) command = ListCommand(["-f", "ical"], todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(todolist.is_dirty()) self.assertTrue(todolist.dirty)
icaltext = "" icaltext = ""
with codecs.open('test/data/ListCommandUnicodeTest.ics', 'r', with codecs.open('test/data/ListCommandUnicodeTest.ics', 'r',
......
...@@ -49,7 +49,7 @@ class PostponeCommandTest(CommandTest): ...@@ -49,7 +49,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 1| Foo due:{}\n".format(due.isoformat())) "| 1| Foo due:{}\n".format(due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -61,7 +61,7 @@ class PostponeCommandTest(CommandTest): ...@@ -61,7 +61,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 2| Bar due:{}\n".format(due.isoformat())) "| 2| Bar due:{}\n".format(due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -73,7 +73,7 @@ class PostponeCommandTest(CommandTest): ...@@ -73,7 +73,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 2| Bar due:{}\n".format(due.isoformat())) "| 2| Bar due:{}\n".format(due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -85,7 +85,7 @@ class PostponeCommandTest(CommandTest): ...@@ -85,7 +85,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 3| Baz due:{} t:{}\n".format(due.isoformat(), self.start.isoformat())) self.assertEqual(self.output, "| 3| Baz due:{} t:{}\n".format(due.isoformat(), self.start.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -97,7 +97,7 @@ class PostponeCommandTest(CommandTest): ...@@ -97,7 +97,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
start = self.start + timedelta(7) start = self.start + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
# pylint: disable=E1103 # pylint: disable=E1103
self.assertEqual(self.output, "| 3| Baz due:{} t:{}\n".format(due.isoformat(), start.isoformat())) self.assertEqual(self.output, "| 3| Baz due:{} t:{}\n".format(due.isoformat(), start.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -109,7 +109,7 @@ class PostponeCommandTest(CommandTest): ...@@ -109,7 +109,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 4| Past due:{}\n".format(due.isoformat())) "| 4| Past due:{}\n".format(due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -121,7 +121,7 @@ class PostponeCommandTest(CommandTest): ...@@ -121,7 +121,7 @@ class PostponeCommandTest(CommandTest):
due = self.future + timedelta(7) due = self.future + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
# pylint: disable=E1103 # pylint: disable=E1103
self.assertEqual(self.output, "| 5| Future due:{} t:{}\n".format(due.isoformat(), self.future_start.isoformat())) self.assertEqual(self.output, "| 5| Future due:{} t:{}\n".format(due.isoformat(), self.future_start.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -134,7 +134,7 @@ class PostponeCommandTest(CommandTest): ...@@ -134,7 +134,7 @@ class PostponeCommandTest(CommandTest):
due = self.future + timedelta(7) due = self.future + timedelta(7)
start = self.future_start + timedelta(7) start = self.future_start + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
# pylint: disable=E1103 # pylint: disable=E1103
self.assertEqual(self.output, "| 5| Future due:{} t:{}\n".format(due.isoformat(), start.isoformat())) self.assertEqual(self.output, "| 5| Future due:{} t:{}\n".format(due.isoformat(), start.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -144,7 +144,7 @@ class PostponeCommandTest(CommandTest): ...@@ -144,7 +144,7 @@ class PostponeCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid date pattern given.\n") self.assertEqual(self.errors, "Invalid date pattern given.\n")
...@@ -153,7 +153,7 @@ class PostponeCommandTest(CommandTest): ...@@ -153,7 +153,7 @@ class PostponeCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -162,7 +162,7 @@ class PostponeCommandTest(CommandTest): ...@@ -162,7 +162,7 @@ class PostponeCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -170,7 +170,7 @@ class PostponeCommandTest(CommandTest): ...@@ -170,7 +170,7 @@ class PostponeCommandTest(CommandTest):
command = PostponeCommand(["1"], self.todolist, self.out, self.error) command = PostponeCommand(["1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -181,7 +181,7 @@ class PostponeCommandTest(CommandTest): ...@@ -181,7 +181,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 1| Foo due:{}\n".format(due.isoformat())) "| 1| Foo due:{}\n".format(due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -193,7 +193,7 @@ class PostponeCommandTest(CommandTest): ...@@ -193,7 +193,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 1| Foo due:{}\n| 2| Bar due:{}\n".format(due.isoformat(), due.isoformat())) self.assertEqual(self.output, "| 1| Foo due:{}\n| 2| Bar due:{}\n".format(due.isoformat(), due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -204,7 +204,7 @@ class PostponeCommandTest(CommandTest): ...@@ -204,7 +204,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 1| Foo due:{}\n| 2| Bar due:{}\n".format(due.isoformat(), due.isoformat())) self.assertEqual(self.output, "| 1| Foo due:{}\n| 2| Bar due:{}\n".format(due.isoformat(), due.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -216,7 +216,7 @@ class PostponeCommandTest(CommandTest): ...@@ -216,7 +216,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
start = self.start + timedelta(7) start = self.start + timedelta(7)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
# pylint: disable=E1103 # pylint: disable=E1103
self.assertEqual(self.output, "| 2| Bar due:{}\n| 3| Baz due:{} t:{}\n".format(due.isoformat(), due.isoformat(), start.isoformat())) self.assertEqual(self.output, "| 2| Bar due:{}\n| 3| Baz due:{} t:{}\n".format(due.isoformat(), due.isoformat(), start.isoformat()))
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -226,7 +226,7 @@ class PostponeCommandTest(CommandTest): ...@@ -226,7 +226,7 @@ class PostponeCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid date pattern given.\n") self.assertEqual(self.errors, "Invalid date pattern given.\n")
...@@ -235,7 +235,7 @@ class PostponeCommandTest(CommandTest): ...@@ -235,7 +235,7 @@ class PostponeCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: 123.\n") self.assertEqual(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: 123.\n")
...@@ -244,7 +244,7 @@ class PostponeCommandTest(CommandTest): ...@@ -244,7 +244,7 @@ class PostponeCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number given: Zoo.\nInvalid todo number given: 99.\nInvalid todo number given: 123.\n") self.assertEqual(self.errors, "Invalid todo number given: Zoo.\nInvalid todo number given: 99.\nInvalid todo number given: 123.\n")
...@@ -254,7 +254,7 @@ class PostponeCommandTest(CommandTest): ...@@ -254,7 +254,7 @@ class PostponeCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, self.assertEqual(self.errors,
u"Invalid todo number given: Fo\u00d3B\u0105r.\n") u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
...@@ -267,7 +267,7 @@ class PostponeCommandTest(CommandTest): ...@@ -267,7 +267,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(14) 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()) 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.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -282,7 +282,7 @@ class PostponeCommandTest(CommandTest): ...@@ -282,7 +282,7 @@ class PostponeCommandTest(CommandTest):
result = "| 3| Baz due:{} t:{}\n".format(due.isoformat(), result = "| 3| Baz due:{} t:{}\n".format(due.isoformat(),
self.start.isoformat()) self.start.isoformat())
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -291,7 +291,7 @@ class PostponeCommandTest(CommandTest): ...@@ -291,7 +291,7 @@ class PostponeCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_postpone4(self): def test_expr_postpone4(self):
""" Don't postpone unrelevant todo items. """ """ Don't postpone unrelevant todo items. """
...@@ -299,7 +299,7 @@ class PostponeCommandTest(CommandTest): ...@@ -299,7 +299,7 @@ class PostponeCommandTest(CommandTest):
self.out, self.error, None) self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_postpone5(self): def test_expr_postpone5(self):
""" Force postponing unrelevant items with additional -x flag. """ """ Force postponing unrelevant items with additional -x flag. """
...@@ -310,7 +310,7 @@ class PostponeCommandTest(CommandTest): ...@@ -310,7 +310,7 @@ class PostponeCommandTest(CommandTest):
due = self.today + timedelta(7) due = self.today + timedelta(7)
result = "| 6| FutureStart t:{} due:{}\n".format(self.future.isoformat(), due.isoformat()) result = "| 6| FutureStart t:{} due:{}\n".format(self.future.isoformat(), due.isoformat())
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
......
...@@ -39,7 +39,7 @@ class PriorityCommandTest(CommandTest): ...@@ -39,7 +39,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"Priority changed from A to B\n| 1| (B) Foo\n") "Priority changed from A to B\n| 1| (B) Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -49,7 +49,7 @@ class PriorityCommandTest(CommandTest): ...@@ -49,7 +49,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Priority set to Z.\n| 2| (Z) Bar\n") self.assertEqual(self.output, "Priority set to Z.\n| 2| (Z) Bar\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -58,7 +58,7 @@ class PriorityCommandTest(CommandTest): ...@@ -58,7 +58,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"Priority changed from A to B\n| 1| (B) Foo\n") "Priority changed from A to B\n| 1| (B) Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -68,7 +68,7 @@ class PriorityCommandTest(CommandTest): ...@@ -68,7 +68,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| (A) Foo\n") self.assertEqual(self.output, "| 1| (A) Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -77,7 +77,7 @@ class PriorityCommandTest(CommandTest): ...@@ -77,7 +77,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Priority changed from A to C\n| 1| (C) Foo\nPriority set to C.\n| 2| (C) Bar\n") self.assertEqual(self.output, "Priority changed from A to C\n| 1| (C) Foo\nPriority set to C.\n| 2| (C) Bar\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -87,7 +87,7 @@ class PriorityCommandTest(CommandTest): ...@@ -87,7 +87,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Priority changed from A to C\n| 1| (C) Foo\nPriority set to C.\n| 2| (C) Bar\n") self.assertEqual(self.output, "Priority changed from A to C\n| 1| (C) Foo\nPriority set to C.\n| 2| (C) Bar\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -97,7 +97,7 @@ class PriorityCommandTest(CommandTest): ...@@ -97,7 +97,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "Priority changed from A to C\n| 1| (C) Foo\nPriority set to C.\n| 2| (C) Bar\n") self.assertEqual(self.output, "Priority changed from A to C\n| 1| (C) Foo\nPriority set to C.\n| 2| (C) Bar\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -108,7 +108,7 @@ class PriorityCommandTest(CommandTest): ...@@ -108,7 +108,7 @@ class PriorityCommandTest(CommandTest):
result = "Priority changed from B to C\n| 3| (C) a @test with due:2015-06-03\nPriority set to C.\n| 4| (C) a @test with +project p:1\n" result = "Priority changed from B to C\n| 3| (C) a @test with due:2015-06-03\nPriority set to C.\n| 4| (C) a @test with +project p:1\n"
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -119,7 +119,7 @@ class PriorityCommandTest(CommandTest): ...@@ -119,7 +119,7 @@ class PriorityCommandTest(CommandTest):
result = "Priority changed from B to C\n| 3| (C) a @test with due:2015-06-03\n" result = "Priority changed from B to C\n| 3| (C) a @test with due:2015-06-03\n"
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, result) self.assertEqual(self.output, result)
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -129,7 +129,7 @@ class PriorityCommandTest(CommandTest): ...@@ -129,7 +129,7 @@ class PriorityCommandTest(CommandTest):
None) None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_prio4(self): def test_expr_prio4(self):
""" Don't prioritize unrelevant todo items. """ """ Don't prioritize unrelevant todo items. """
...@@ -137,7 +137,7 @@ class PriorityCommandTest(CommandTest): ...@@ -137,7 +137,7 @@ class PriorityCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_expr_prio5(self): def test_expr_prio5(self):
""" Force prioritizing unrelevant items with additional -x flag. """ """ Force prioritizing unrelevant items with additional -x flag. """
...@@ -145,7 +145,7 @@ class PriorityCommandTest(CommandTest): ...@@ -145,7 +145,7 @@ class PriorityCommandTest(CommandTest):
self.error, None) self.error, None)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"Priority set to D.\n| 5| (D) Baz id:1\n") "Priority set to D.\n| 5| (D) Baz id:1\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -155,7 +155,7 @@ class PriorityCommandTest(CommandTest): ...@@ -155,7 +155,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given.\n") self.assertEqual(self.errors, "Invalid todo number given.\n")
...@@ -164,7 +164,7 @@ class PriorityCommandTest(CommandTest): ...@@ -164,7 +164,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given: 99.\n") self.assertEqual(self.errors, "Invalid todo number given: 99.\n")
...@@ -173,7 +173,7 @@ class PriorityCommandTest(CommandTest): ...@@ -173,7 +173,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number given: 98.\nInvalid todo number given: 99.\n") self.assertEqual(self.errors, "Invalid todo number given: 98.\nInvalid todo number given: 99.\n")
...@@ -182,7 +182,7 @@ class PriorityCommandTest(CommandTest): ...@@ -182,7 +182,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid priority given.\n") self.assertEqual(self.errors, "Invalid priority given.\n")
...@@ -190,7 +190,7 @@ class PriorityCommandTest(CommandTest): ...@@ -190,7 +190,7 @@ class PriorityCommandTest(CommandTest):
command = PriorityCommand(["A"], self.todolist, self.out, self.error) command = PriorityCommand(["A"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -198,7 +198,7 @@ class PriorityCommandTest(CommandTest): ...@@ -198,7 +198,7 @@ class PriorityCommandTest(CommandTest):
command = PriorityCommand(["1"], self.todolist, self.out, self.error) command = PriorityCommand(["1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
...@@ -210,7 +210,7 @@ class PriorityCommandTest(CommandTest): ...@@ -210,7 +210,7 @@ class PriorityCommandTest(CommandTest):
self.todolist, self.out, self.error, None) self.todolist, self.out, self.error, None)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, self.assertEqual(self.errors,
u"Invalid todo number given: Fo\u00d3B\u0105r.\n") u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
...@@ -224,7 +224,7 @@ class PriorityCommandTest(CommandTest): ...@@ -224,7 +224,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid priority given.\n") self.assertEqual(self.errors, "Invalid priority given.\n")
...@@ -237,7 +237,7 @@ class PriorityCommandTest(CommandTest): ...@@ -237,7 +237,7 @@ class PriorityCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid priority given.\n") self.assertEqual(self.errors, "Invalid priority given.\n")
...@@ -245,7 +245,7 @@ class PriorityCommandTest(CommandTest): ...@@ -245,7 +245,7 @@ class PriorityCommandTest(CommandTest):
command = PriorityCommand([], self.todolist, self.out, self.error) command = PriorityCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
......
...@@ -42,7 +42,7 @@ class TagCommandTest(CommandTest): ...@@ -42,7 +42,7 @@ class TagCommandTest(CommandTest):
self.assertEqual(self.todolist.todo(1).source(), "Foo due:2014-10-22") self.assertEqual(self.todolist.todo(1).source(), "Foo due:2014-10-22")
self.assertEqual(self.output, "| 1| Foo due:2014-10-22\n") self.assertEqual(self.output, "| 1| Foo due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_add_tag2(self): def test_add_tag2(self):
command = TagCommand(["Foo", "due", "2014-10-22"], self.todolist, command = TagCommand(["Foo", "due", "2014-10-22"], self.todolist,
...@@ -52,7 +52,7 @@ class TagCommandTest(CommandTest): ...@@ -52,7 +52,7 @@ class TagCommandTest(CommandTest):
self.assertEqual(self.todolist.todo(1).source(), "Foo due:2014-10-22") self.assertEqual(self.todolist.todo(1).source(), "Foo due:2014-10-22")
self.assertEqual(self.output, "| 1| Foo due:2014-10-22\n") self.assertEqual(self.output, "| 1| Foo due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_add_tag3(self): def test_add_tag3(self):
command = TagCommand(["-a", "2", "due", "2014-10-19"], self.todolist, command = TagCommand(["-a", "2", "due", "2014-10-19"], self.todolist,
...@@ -64,14 +64,14 @@ class TagCommandTest(CommandTest): ...@@ -64,14 +64,14 @@ class TagCommandTest(CommandTest):
self.assertEqual(self.output, self.assertEqual(self.output,
"| 2| Bar due:2014-10-22 due:2014-10-19\n") "| 2| Bar due:2014-10-22 due:2014-10-19\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_add_tag4(self): def test_add_tag4(self):
command = TagCommand(["Foox", "due", "2014-10-22"], self.todolist, command = TagCommand(["Foox", "due", "2014-10-22"], self.todolist,
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertFalse(self.output) self.assertFalse(self.output)
self.assertEqual(self.errors, "Invalid todo number.\n") self.assertEqual(self.errors, "Invalid todo number.\n")
...@@ -80,7 +80,7 @@ class TagCommandTest(CommandTest): ...@@ -80,7 +80,7 @@ class TagCommandTest(CommandTest):
self.out, self.error) self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 3| Baz due:2014-10-20\n") self.assertEqual(self.output, "| 3| Baz due:2014-10-20\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -89,7 +89,7 @@ class TagCommandTest(CommandTest): ...@@ -89,7 +89,7 @@ class TagCommandTest(CommandTest):
self.out, self.error, lambda t: "all") self.out, self.error, lambda t: "all")
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-20\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-20\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -98,7 +98,7 @@ class TagCommandTest(CommandTest): ...@@ -98,7 +98,7 @@ class TagCommandTest(CommandTest):
self.out, self.error, lambda t: "1") self.out, self.error, lambda t: "1")
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -107,7 +107,7 @@ class TagCommandTest(CommandTest): ...@@ -107,7 +107,7 @@ class TagCommandTest(CommandTest):
self.out, self.error, lambda t: "2") self.out, self.error, lambda t: "2")
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-20\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-20\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -116,7 +116,7 @@ class TagCommandTest(CommandTest): ...@@ -116,7 +116,7 @@ class TagCommandTest(CommandTest):
self.out, self.error, lambda t: "") self.out, self.error, lambda t: "")
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -125,7 +125,7 @@ class TagCommandTest(CommandTest): ...@@ -125,7 +125,7 @@ class TagCommandTest(CommandTest):
self.out, self.error, lambda t: "99") self.out, self.error, lambda t: "99")
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -134,7 +134,7 @@ class TagCommandTest(CommandTest): ...@@ -134,7 +134,7 @@ class TagCommandTest(CommandTest):
self.out, self.error, lambda t: "99") self.out, self.error, lambda t: "99")
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
"| 4| Fnord due:2014-10-20 due:2014-10-20\n") "| 4| Fnord due:2014-10-20 due:2014-10-20\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -145,7 +145,7 @@ class TagCommandTest(CommandTest): ...@@ -145,7 +145,7 @@ class TagCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 3| Baz due:2015-11-19\n") self.assertEqual(self.output, "| 3| Baz due:2015-11-19\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -158,7 +158,7 @@ class TagCommandTest(CommandTest): ...@@ -158,7 +158,7 @@ class TagCommandTest(CommandTest):
self.error) self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 3| Baz due:2014-10-20 foo:today\n") self.assertEqual(self.output, "| 3| Baz due:2014-10-20 foo:today\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -166,7 +166,7 @@ class TagCommandTest(CommandTest): ...@@ -166,7 +166,7 @@ class TagCommandTest(CommandTest):
command = TagCommand(["1", "due"], self.todolist, self.out, self.error) command = TagCommand(["1", "due"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| Foo\n") self.assertEqual(self.output, "| 1| Foo\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -174,7 +174,7 @@ class TagCommandTest(CommandTest): ...@@ -174,7 +174,7 @@ class TagCommandTest(CommandTest):
command = TagCommand(["2", "due"], self.todolist, self.out, self.error) command = TagCommand(["2", "due"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 2| Bar\n") self.assertEqual(self.output, "| 2| Bar\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -183,7 +183,7 @@ class TagCommandTest(CommandTest): ...@@ -183,7 +183,7 @@ class TagCommandTest(CommandTest):
self.error, lambda t: "all") self.error, lambda t: "all")
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, self.assertEqual(self.output,
" 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord\n") " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -193,7 +193,7 @@ class TagCommandTest(CommandTest): ...@@ -193,7 +193,7 @@ class TagCommandTest(CommandTest):
lambda t: "1") lambda t: "1")
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-22\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -202,7 +202,7 @@ class TagCommandTest(CommandTest): ...@@ -202,7 +202,7 @@ class TagCommandTest(CommandTest):
lambda t: "99") lambda t: "99")
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -211,7 +211,7 @@ class TagCommandTest(CommandTest): ...@@ -211,7 +211,7 @@ class TagCommandTest(CommandTest):
lambda t: "A") lambda t: "A")
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n") self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n| 4| Fnord due:2014-10-20 due:2014-10-22\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -219,7 +219,7 @@ class TagCommandTest(CommandTest): ...@@ -219,7 +219,7 @@ class TagCommandTest(CommandTest):
command = TagCommand(["5", "due"], self.todolist, self.out, self.error) command = TagCommand(["5", "due"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number.\n") self.assertEqual(self.errors, "Invalid todo number.\n")
...@@ -227,7 +227,7 @@ class TagCommandTest(CommandTest): ...@@ -227,7 +227,7 @@ class TagCommandTest(CommandTest):
command = TagCommand(["A", "due"], self.todolist, self.out, self.error) command = TagCommand(["A", "due"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, "Invalid todo number.\n") self.assertEqual(self.errors, "Invalid todo number.\n")
...@@ -236,7 +236,7 @@ class TagCommandTest(CommandTest): ...@@ -236,7 +236,7 @@ class TagCommandTest(CommandTest):
self.error, lambda t: "A") self.error, lambda t: "A")
command.execute() command.execute()
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertEqual(self.output, "| 4| Fnord\n") self.assertEqual(self.output, "| 4| Fnord\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
...@@ -244,7 +244,7 @@ class TagCommandTest(CommandTest): ...@@ -244,7 +244,7 @@ class TagCommandTest(CommandTest):
command = TagCommand(["4"], self.todolist, self.out, self.error) command = TagCommand(["4"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
......
...@@ -40,12 +40,12 @@ class TodoListTester(TopydoTest): ...@@ -40,12 +40,12 @@ class TodoListTester(TopydoTest):
def test_contexts(self): def test_contexts(self):
self.assertEqual(set(['Context1', 'Context2']), self.assertEqual(set(['Context1', 'Context2']),
self.todolist.contexts()) self.todolist.contexts())
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_projects(self): def test_projects(self):
self.assertEqual(set(['Project1', 'Project2']), self.assertEqual(set(['Project1', 'Project2']),
self.todolist.projects()) self.todolist.projects())
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_add1(self): def test_add1(self):
text = "(C) Adding a new task @Context3 +Project3" text = "(C) Adding a new task @Context3 +Project3"
...@@ -58,7 +58,7 @@ class TodoListTester(TopydoTest): ...@@ -58,7 +58,7 @@ class TodoListTester(TopydoTest):
self.assertEqual(set(['Context1', 'Context2', 'Context3']), self.assertEqual(set(['Context1', 'Context2', 'Context3']),
self.todolist.contexts()) self.todolist.contexts())
self.assertEqual(self.todolist.number(todo), 6) self.assertEqual(self.todolist.number(todo), 6)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_add2(self): def test_add2(self):
text = str(self.todolist) text = str(self.todolist)
...@@ -101,7 +101,7 @@ class TodoListTester(TopydoTest): ...@@ -101,7 +101,7 @@ class TodoListTester(TopydoTest):
self.assertEqual(self.todolist.todo(2).source(), self.assertEqual(self.todolist.todo(2).source(),
"(C) Baz @Context1 +Project1 key:value") "(C) Baz @Context1 +Project1 key:value")
self.assertEqual(self.todolist.count(), count - 1) self.assertEqual(self.todolist.count(), count - 1)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
self.assertRaises(InvalidTodoException, self.todolist.number, todo) self.assertRaises(InvalidTodoException, self.todolist.number, todo)
def test_delete2(self): def test_delete2(self):
...@@ -112,7 +112,7 @@ class TodoListTester(TopydoTest): ...@@ -112,7 +112,7 @@ class TodoListTester(TopydoTest):
self.todolist.delete(todo) self.todolist.delete(todo)
self.assertEqual(self.todolist.count(), count) self.assertEqual(self.todolist.count(), count)
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_append1(self): def test_append1(self):
todo = self.todolist.todo(3) todo = self.todolist.todo(3)
...@@ -122,7 +122,7 @@ class TodoListTester(TopydoTest): ...@@ -122,7 +122,7 @@ class TodoListTester(TopydoTest):
"(C) Baz @Context1 +Project1 key:value @Context3") "(C) Baz @Context1 +Project1 key:value @Context3")
self.assertEqual(set(['Context1', 'Context2', 'Context3']), self.assertEqual(set(['Context1', 'Context2', 'Context3']),
self.todolist.contexts()) self.todolist.contexts())
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_append2(self): def test_append2(self):
todo = self.todolist.todo(3) todo = self.todolist.todo(3)
...@@ -145,7 +145,7 @@ class TodoListTester(TopydoTest): ...@@ -145,7 +145,7 @@ class TodoListTester(TopydoTest):
self.assertRaises(InvalidTodoException, self.todolist.todo, self.assertRaises(InvalidTodoException, self.todolist.todo,
count + 100) count + 100)
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_count(self): def test_count(self):
""" Test that empty lines are not counted. """ """ Test that empty lines are not counted. """
...@@ -167,26 +167,26 @@ class TodoListTester(TopydoTest): ...@@ -167,26 +167,26 @@ class TodoListTester(TopydoTest):
todo = self.todolist.todo(1) todo = self.todolist.todo(1)
self.todolist.set_todo_completed(todo) self.todolist.set_todo_completed(todo)
self.assertTrue(self.todolist.todo(1).is_completed()) self.assertTrue(self.todolist.todo(1).is_completed())
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_todo_priority1(self): def test_todo_priority1(self):
todo = self.todolist.todo(1) todo = self.todolist.todo(1)
self.todolist.set_priority(todo, 'F') self.todolist.set_priority(todo, 'F')
self.assertEqual(self.todolist.todo(1).priority(), 'F') self.assertEqual(self.todolist.todo(1).priority(), 'F')
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_todo_priority2(self): def test_todo_priority2(self):
todo = self.todolist.todo(1) todo = self.todolist.todo(1)
self.todolist.set_priority(todo, 'C') self.todolist.set_priority(todo, 'C')
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.dirty)
def test_erase(self): def test_erase(self):
self.todolist.erase() self.todolist.erase()
self.assertEqual(self.todolist.count(), 0) self.assertEqual(self.todolist.count(), 0)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.dirty)
def test_regex1(self): def test_regex1(self):
""" Multiple hits should result in None. """ """ Multiple hits should result in None. """
......
...@@ -174,7 +174,7 @@ class CLIApplicationBase(object): ...@@ -174,7 +174,7 @@ class CLIApplicationBase(object):
command = ArchiveCommand(self.todolist, archive) command = ArchiveCommand(self.todolist, archive)
command.execute() command.execute()
if archive.is_dirty(): if archive.dirty:
archive_file.write(archive.print_todos()) archive_file.write(archive.print_todos())
def _help(self, args): def _help(self, args):
...@@ -224,7 +224,7 @@ class CLIApplicationBase(object): ...@@ -224,7 +224,7 @@ class CLIApplicationBase(object):
# do not archive when the value of the filename is an empty string # do not archive when the value of the filename is an empty string
# (i.e. explicitly left empty in the configuration # (i.e. explicitly left empty in the configuration
if self.todolist.is_dirty(): if self.todolist.dirty:
if self.do_archive and config().archive(): if self.do_archive and config().archive():
self._archive() self._archive()
......
...@@ -69,7 +69,7 @@ class PostponeCommand(MultiCommand): ...@@ -69,7 +69,7 @@ class PostponeCommand(MultiCommand):
# pylint: disable=E1103 # pylint: disable=E1103
todo.set_tag(config().tag_due(), new_due.isoformat()) todo.set_tag(config().tag_due(), new_due.isoformat())
self.todolist.set_dirty() self.todolist.dirty = True
self.out(self.printer.print_todo(todo)) self.out(self.printer.print_todo(todo))
else: else:
self.error("Invalid date pattern given.") self.error("Invalid date pattern given.")
......
...@@ -106,7 +106,7 @@ class TagCommand(Command): ...@@ -106,7 +106,7 @@ class TagCommand(Command):
self.todo.set_tag(self.tag, self.value, self.force_add, p_old_value) self.todo.set_tag(self.tag, self.value, self.force_add, p_old_value)
if old_src != self.todo.source(): if old_src != self.todo.source():
self.todolist.set_dirty() self.todolist.dirty = True
def _set(self): def _set(self):
if len(self.current_values) > 1: if len(self.current_values) > 1:
......
...@@ -112,7 +112,7 @@ class IcalPrinter(Printer): ...@@ -112,7 +112,7 @@ class IcalPrinter(Printer):
if not uid: if not uid:
uid = generate_uid() uid = generate_uid()
p_todo.set_tag('ical', uid) p_todo.set_tag('ical', uid)
self.todolist.set_dirty() self.todolist.dirty = True
return uid return uid
......
...@@ -52,7 +52,7 @@ class TodoListBase(object): ...@@ -52,7 +52,7 @@ class TodoListBase(object):
self._id_todo_map = {} self._id_todo_map = {}
self.add_list(p_todostrings) self.add_list(p_todostrings)
self.dirty = False self._dirty = False
def todo(self, p_identifier): def todo(self, p_identifier):
""" """
...@@ -221,11 +221,13 @@ class TodoListBase(object): ...@@ -221,11 +221,13 @@ class TodoListBase(object):
""" """
return View(p_sorter, p_filters, self) return View(p_sorter, p_filters, self)
def is_dirty(self): @property
return self.dirty def dirty(self):
return self._dirty
def set_dirty(self): @dirty.setter
self.dirty = True def dirty(self, p_flag):
self._dirty = p_flag
def todos(self): def todos(self):
return self._todos return self._todos
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment