def test_NotesApplication_get(self): """Tests if the get method \ returns False \ when the ID selected is out of range. """ get1 = NotesApplication('John') get1.create("Nigeria") get1.create("Andela") self.assertEqual(False, get1.get(7), msg="Wrong entry! Type a word or text!")
def test_retrieve_notes_invalid_index(self): author_notes = NotesApplication('New Author', "Test Content1") author_note = author_notes.get(-10) self.assertEqual(author_note, "Invalid Index", msg='Retrieving a note with Invalid Index should fail')
def test_retrieve_notes_valid_index(self): notes = NotesApplication('Author') notes.create("Test Content") note = notes.get(0) self.assertEqual(note, "Test Content", msg='Retrieving a note with a valid index should return the correct note')
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": note_index = raw_input("Please enter index of note to delete: ") while not note_index.isdigit(): note_index = raw_input("Please enter valid index of note to delete: ") else: note_index = int(note_index) notes.delete(note_index) elif res=="e": edit_no = raw_input("Please enter index of note to edit: ") while not edit_no.isdigit(): edit_no = raw_input("Please enter valid index of note to edit: ")