def testAddATodoWithADependant(self): chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodo(self.app, ["go to the shops", "before", "buy more milk"]) self.assertEqual(self.app.totalTodoCount, 2) self.assertEqual(self.app.getTodo(0), "go to the shops") self.assertEqual(self.app.visibleTodoCount, 1)
def testAddNewTodoAtTheTopOfTheList(self): chaido.addNewTodo(self.app, ["write a book"]) chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodoToTop(self.app, ["go to the shops"]) self.assertEqual(self.app.totalTodoCount, 3) self.assertEqual(self.app.visibleTodoCount, 3) self.assertEqual(self.app.getTodo(0), "go to the shops") self.assertEqual(self.app.getTodo(1), "write a book") self.assertEqual(self.app.getTodo(2), "buy more milk")
def testAddMultipleTodoWithASpecifiedWithIndex(self): chaido.addNewTodo(self.app, ["write a book"]) chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodo(self.app, ["go to the shops", "before", "1", "2"]) self.assertEqual(self.app.totalTodoCount, 3) self.assertEqual(self.app.visibleTodoCount, 1) self.assertEqual(self.app.getTodo(0), "go to the shops")
def testListingAllTasks(self): self.app = MockChaiDoApp() chaido.addNewTodo(self.app, ["buy pens"]) chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodo(self.app, ["write a book"]) chaido.addNewTodo(self.app, ["go to the shops"]) chaido.setTaskAsDependant(self.app, ["4", "before", "1"]) self.assertEqual(chaido.listToDos(self.app, []), """1: buy more milk 2: write a book 3: go to the shops""") self.assertEqual(chaido.listAllToDos(self.app, []), """buy pens buy more milk write a book go to the shops""")
def testListingAllTasks(self): self.app = MockChaiDoApp() chaido.addNewTodo(self.app, ["buy pens"]) chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodo(self.app, ["write a book"]) chaido.addNewTodo(self.app, ["go to the shops"]) chaido.setTaskAsDependant(self.app, ["4", "before", "1"]) self.assertEqual( chaido.listToDos(self.app, []), """1: buy more milk 2: write a book 3: go to the shops""") self.assertEqual( chaido.listAllToDos(self.app, []), """buy pens buy more milk write a book go to the shops""")
def testRemovingMultipleTasksInNonDecreasingOrder(self): chaido.addNewTodo(self.app, ["buy more cheese"]) chaido.addNewTodo(self.app, ["buy more eggs"]) chaido.addNewTodo(self.app, ["buy more flour"]) self.assertEqual(self.app.visibleTodoCount, 4) self.assertEqual(self.app.totalTodoCount, 5) self.assertEqual(self.app.getTodo(0), "go to the shops") self.assertEqual(self.app.getTodo(1), "buy more cheese") self.assertEqual(self.app.getTodo(2), "buy more eggs") self.assertEqual(self.app.getTodo(3), "buy more flour") chaido.removeTodo(self.app, ["1", "2", "3"]) self.assertEqual(self.app.visibleTodoCount, 2) self.assertEqual(self.app.totalTodoCount, 2) self.assertEqual(self.app.getTodo(0), "buy more milk") self.assertEqual(self.app.getTodo(1), "buy more flour")
def setUp(self): self.app = MockChaiDoApp() chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodo(self.app, ["go to the shops", "before", "buy more milk"])
def setUp(self): self.app = MockChaiDoApp() chaido.addNewTodo(self.app, ["buy pens"]) chaido.addNewTodo(self.app, ["buy more milk"]) chaido.addNewTodo(self.app, ["write a book"]) chaido.addNewTodo(self.app, ["go to the shops"])
def testAddATodo(self): chaido.addNewTodo(self.app, ["buy more milk"]) self.assertEqual(self.app.totalTodoCount, 1) self.assertEqual(self.app.getTodo(0), "buy more milk")
def testListingTwoTasks(self): expectedResult = """1: buy more milk 2: write a book""" self.assertEqual(chaido.listToDos(self.app, []), expectedResult) chaido.addNewTodo(self.app, ["go to the shops", "before", "buy more milk"])