def test_NotesApplication_search(self):
     """Tests if the search method returns a 'Not found' string."""
     search = NotesApplication('John')
     search.create("Nigeria")
     search.create("Andela")
     self.assertEqual(False, search.search("lists"),
                      msg="Wrong entry! Type a word or text!")
		def test_search_notes1(self):
			author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"])
			notes_list = author_notes.search("Content4")
			self.assertListEqual(notes_list, [], msg='search should return an empty array when no text is found in any notes')
		def test_search_notes(self):
			author_notes = NotesApplication('New Author', ["Test Content1", "Test Content2", "Test Content3"])
			notes_list = author_notes.search("Content")
			self.assertListEqual(notes_list, ["Test Content1", "Test Content2", "Test Content3"], msg='search should return all notes with search string')
예제 #4
0
		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":
			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: