def test_list_notes1(self): author_notes = NotesApplication('New Author', []) notes_list = author_notes.list() self.assertListEqual(notes_list, [], msg='list() should return empty list when not instantiated')
def test_list_notes(self): author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"]) notes_list = author_notes.list() self.assertListEqual(notes_list, ["Test Content1", "Test Content2", "Test Content3"], msg='list() should return all created notes')
def test_edit_valid_index(self): author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"]) author_notes.edit(1, "Test Content4") notes_list = author_notes.list() self.assertListEqual(notes_list, ["Test Content1", "Test Content4", "Test Content3"], msg='Edit should alter supplied index in the notes list')
def test_edit_invalid_index1(self): author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"]) author_notes.edit(-3, "Test Content4") notes_result = author_notes.list() self.assertTrue(notes_result, msg='Delete should return True for a negative Invalid Index')
notes.create(notes_content) print("\n\nNotes have been saved successfully") print("\n\n\t\t\t\t\t\t\t\tMenu\t\t\t\t\t\t\t\t\t\t\t\t\t\t") print("\n------------------------------------------------------------------------------------------------------------------------------------") print("\n\nPress m to return to menu") print("\nPress s to search for a specific string") print("\nPress r to retrieve a specific note") print("\nPress d to delete a specific note") print("\nPress e to edit a specific note") print("\nPress l to retrieve all notes: ") res = raw_input("\nEnter Choice: ") if(res=="l"): notes.list() elif res=="m": continue elif res=="s": search_text = raw_input("Please enter search text: ") notes.search(search_text) elif res=="r": index = raw_input("Please enter index of note to retrieve: ") while not index.isdigit(): index = raw_input("Please enter valid index of note to retrieve: ") else: index = int(index) print "\n" + notes.get(index) elif res=="d":