Commit e3301ee6 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Rename function.

parent 3e4ddb7d
...@@ -11,7 +11,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -11,7 +11,7 @@ class AddCommandTest(CommandTest.CommandTest):
def test_add_task(self): def test_add_task(self):
args = ["New todo"] args = ["New todo"]
command = AddCommand.AddCommand(args, self.todolist, self.out, self.err) command = AddCommand.AddCommand(args, self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " New todo") self.assertEquals(self.todolist.todo(1).source(), self.today + " New todo")
...@@ -19,14 +19,14 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -19,14 +19,14 @@ class AddCommandTest(CommandTest.CommandTest):
def test_add_multiple_args(self): def test_add_multiple_args(self):
args = ["New", "todo"] args = ["New", "todo"]
command = AddCommand.AddCommand(args, self.todolist, self.out, self.err) command = AddCommand.AddCommand(args, self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " New todo") self.assertEquals(self.todolist.todo(1).source(), self.today + " New todo")
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_priority1(self): def test_add_priority1(self):
command = AddCommand.AddCommand(["Foo (C)"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo (C)"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).priority(), 'C') self.assertEquals(self.todolist.todo(1).priority(), 'C')
...@@ -34,7 +34,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -34,7 +34,7 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_priority2(self): def test_add_priority2(self):
command = AddCommand.AddCommand(["Foo (CC)"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo (CC)"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).priority(), None) self.assertEquals(self.todolist.todo(1).priority(), None)
...@@ -42,7 +42,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -42,7 +42,7 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_priority3(self): def test_add_priority3(self):
command = AddCommand.AddCommand(["Fo(C)o"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Fo(C)o"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).priority(), None) self.assertEquals(self.todolist.todo(1).priority(), None)
...@@ -50,7 +50,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -50,7 +50,7 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_priority4(self): def test_add_priority4(self):
command = AddCommand.AddCommand(["(C) Foo"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["(C) Foo"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).priority(), 'C') self.assertEquals(self.todolist.todo(1).priority(), 'C')
...@@ -58,10 +58,10 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -58,10 +58,10 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_dep1(self): def test_add_dep1(self):
command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.error)
command.execute() command.execute()
command = AddCommand.AddCommand(["Bar before:1"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Bar before:1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo id:1") self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo id:1")
...@@ -69,7 +69,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -69,7 +69,7 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_dep2(self): def test_add_dep2(self):
command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.error)
command.execute() command.execute()
command = AddCommand.AddCommand(["Bar partof:1"], self.todolist) command = AddCommand.AddCommand(["Bar partof:1"], self.todolist)
...@@ -83,7 +83,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -83,7 +83,7 @@ class AddCommandTest(CommandTest.CommandTest):
command = AddCommand.AddCommand(["Foo"], self.todolist) command = AddCommand.AddCommand(["Foo"], self.todolist)
command.execute() command.execute()
command = AddCommand.AddCommand(["Bar after:1"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Bar after:1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo p:1") self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo p:1")
...@@ -92,7 +92,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -92,7 +92,7 @@ class AddCommandTest(CommandTest.CommandTest):
def test_add_dep4(self): def test_add_dep4(self):
""" Test for using an after: tag with non-existing value. """ """ Test for using an after: tag with non-existing value. """
command = AddCommand.AddCommand(["Foo after:1"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo after:1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.todo(1).has_tag("after")) self.assertFalse(self.todolist.todo(1).has_tag("after"))
...@@ -102,7 +102,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -102,7 +102,7 @@ class AddCommandTest(CommandTest.CommandTest):
def test_add_dep4(self): def test_add_dep4(self):
""" Test for using an after: tag with non-existing value. """ """ Test for using an after: tag with non-existing value. """
command = AddCommand.AddCommand(["Foo after:2"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo after:2"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.todo(1).has_tag("after")) self.assertFalse(self.todolist.todo(1).has_tag("after"))
...@@ -111,13 +111,13 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -111,13 +111,13 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_dep5(self): def test_add_dep5(self):
command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.error)
command.execute() command.execute()
command = AddCommand.AddCommand(["Bar"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Bar"], self.todolist, self.out, self.error)
command.execute() command.execute()
command = AddCommand.AddCommand(["Baz before:1 before:2"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Baz before:1 before:2"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo id:1") self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo id:1")
...@@ -126,13 +126,13 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -126,13 +126,13 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_dep6(self): def test_add_dep6(self):
command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.error)
command.execute() command.execute()
command = AddCommand.AddCommand(["Bar"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Bar"], self.todolist, self.out, self.error)
command.execute() command.execute()
command = AddCommand.AddCommand(["Baz after:1 after:2"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Baz after:1 after:2"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo p:1") self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo p:1")
...@@ -141,14 +141,14 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -141,14 +141,14 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_reldate1(self): def test_add_reldate1(self):
command = AddCommand.AddCommand(["Foo due:today"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo due:today"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo due:" + self.today) self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo due:" + self.today)
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_reldate2(self): def test_add_reldate2(self):
command = AddCommand.AddCommand(["Foo t:today due:today"], self.todolist, self.out, self.err) command = AddCommand.AddCommand(["Foo t:today due:today"], self.todolist, self.out, self.error)
command.execute() command.execute()
result = " 1 %s Foo t:%s due:%s\n" % (self.today, self.today, self.today) result = " 1 %s Foo t:%s due:%s\n" % (self.today, self.today, self.today)
...@@ -156,7 +156,7 @@ class AddCommandTest(CommandTest.CommandTest): ...@@ -156,7 +156,7 @@ class AddCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_add_empty(self): def test_add_empty(self):
command = AddCommand.AddCommand([], self.todolist, self.out, self.err) command = AddCommand.AddCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEquals(self.output, "") self.assertEquals(self.output, "")
......
...@@ -8,49 +8,49 @@ class AppendCommandTest(CommandTest.CommandTest): ...@@ -8,49 +8,49 @@ class AppendCommandTest(CommandTest.CommandTest):
self.todolist.add("Foo") self.todolist.add("Foo")
def test_append1(self): def test_append1(self):
command = AppendCommand.AppendCommand([1, "Bar"], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand([1, "Bar"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.output, " 1 Foo Bar\n") self.assertEqual(self.output, " 1 Foo Bar\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
def test_append2(self): def test_append2(self):
command = AppendCommand.AppendCommand([2, "Bar"], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand([2, "Bar"], self.todolist, self.out, self.error)
command.execute() command.execute()
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")
def test_append3(self): def test_append3(self):
command = AppendCommand.AppendCommand([1, ""], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand([1, ""], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
def test_append4(self): def test_append4(self):
command = AppendCommand.AppendCommand([1], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand([1], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
def test_append5(self): def test_append5(self):
command = AppendCommand.AppendCommand([1, "Bar", "Baz"], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand([1, "Bar", "Baz"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.output, " 1 Foo Bar Baz\n") self.assertEqual(self.output, " 1 Foo Bar Baz\n")
self.assertEqual(self.errors, "") self.assertEqual(self.errors, "")
def test_append6(self): def test_append6(self):
command = AppendCommand.AppendCommand([], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
self.assertEqual(self.errors, command.usage() + "\n") self.assertEqual(self.errors, command.usage() + "\n")
def test_append7(self): def test_append7(self):
command = AppendCommand.AppendCommand(["Bar"], self.todolist, self.out, self.err) command = AppendCommand.AppendCommand(["Bar"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.output, "") self.assertEqual(self.output, "")
......
...@@ -9,5 +9,5 @@ class CommandTest(unittest.TestCase): ...@@ -9,5 +9,5 @@ class CommandTest(unittest.TestCase):
def out(self, p_output): def out(self, p_output):
self.output += p_output + "\n"; self.output += p_output + "\n";
def err(self, p_error): def error(self, p_error):
self.errors += p_error + "\n"; self.errors += p_error + "\n";
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