Example #1
0
 def test_list_open_items_returns_inprogress_items(self):
     list = todo.List()
     idx = list.add_item("summary")
     list.lookup(idx).inprogress()
     self.assertEqual({idx: list.lookup(idx)}, list.open_items())
     list.lookup(idx).complete()
     self.assertEqual({}, list.open_items())
Example #2
0
 def test_list_size_increases_when_new_item_added(self):
     list = todo.List()
     list.add_item("summary")
     self.assertEqual(1, list.total_count())
Example #3
0
 def test_remove_item_when_item_not_exists(self):
     list = todo.List()
     list.remove_item(999)
Example #4
0
 def test_remove_item_when_item_exists(self):
     list = todo.List()
     idx = list.add_item("summary")
     list.remove_item(idx)
     self.assertEqual(None, list.lookup(idx))
Example #5
0
 def test_add_item_returns_element_index(self):
     list = todo.List()
     summary = "summary1"
     id = list.add_item(summary)
     self.assertEqual(summary, list.lookup(id).description())
Example #6
0
 def test_new_list(self):
     list = todo.List()
     self.assertEqual(0, list.total_count())
Example #7
0
 def test_returns_none_when_missing_element(self):
     list = todo.List()
     self.assertEqual(None, list.lookup(999))
Example #8
0
 def test_items_do_not_collide(self):
     list = todo.List()
     list.add_item("summary")
     self.assertEqual(1, list.total_count())
     list.add_item("summary")
     self.assertEqual(2, list.total_count())
Example #9
0
 def test_list_todo_items_returns_todo_items(self):
     list = todo.List()
     idx = list.add_item("summary")
     self.assertEqual({idx: list.lookup(idx)}, list.todo_items())
     list.lookup(idx).inprogress()
     self.assertEqual({}, list.todo_items())
Example #10
0
 def test_list_todo_item_shows_number_of_todo_items(self):
     list = todo.List()
     list.add_item("summary")
     self.assertEqual(1, list.total_count())