def test_NotesApplication_delete3(self):
     """Tests if the delete method \
     returns a False \
     when the list is empty.\
     """
     delete3 = NotesApplication('John')
     self.assertEqual(False, delete3.delete(3), msg="Sorry list is empty")
 def test_NotesApplication_delete2(self):
     """Tests if the delete method \
     returns False \
     when the ID selected is out of range.
     """
     delete2 = NotesApplication('John')
     delete2.create("Nigeria")
     self.assertEqual(False, delete2.delete(7), msg="Index out of range")
 def test_NotesApplication_delete(self):
     """Tests if the delete method \
     returns a True \
     when a note is successfully deleted\
     """
     delete = NotesApplication('John')
     delete.create("Nigeria")
     delete.create("Andela")
     self.assertEqual("Note successfully deleted!", delete.delete(0))
		def test_delete_invalid_index(self):
			author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"])
			delete_result = author_notes.delete(4)
			self.assertTrue(delete_result, msg='Delete should return True for a wrong index')
		def test_delete_valid_index(self):
			author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"])
			author_notes.delete(2)
			notes_length = len(author_notes.notes)
			self.assertEqual(notes_length, 2, msg='Delete should reduce the size of the list')
예제 #6
0
			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: ")
			else:
				edit_no = int(edit_no)
			edit_text = raw_input("Please enter text: ")
			notes.edit(edit_no, edit_text)



		else:
			print("\n\nNot a valid response, Returning you back to menu")