コード例 #1
0
 def test_delete_note(self):
     erika = NotesApplication("Erika")
     erika.create("Reality")
     erika.create("Merciless giver")
     erika.create("Real studio")
     appOutput = ("Note ID: 0\nReality\n\n\nBy Author Erika\n"
                  "Note ID: 1\nReal studio\n\n\nBy Author Erika\n"
                 )
     erika.delete(1)
     with capture(erika.list) as output:
         self.assertEqual(appOutput, output, msg="delete() method does not delete the note specified by index")
コード例 #2
0
 def test_delete_note(self):
     erika = NotesApplication("Erika")
     erika.create("Reality")
     erika.create("Merciless giver")
     erika.create("Real studio")
     appOutput = ("Note ID: 0\nReality\n\n\nBy Author Erika\n"
                  "Note ID: 1\nReal studio\n\n\nBy Author Erika\n")
     erika.delete(1)
     with capture(erika.list) as output:
         self.assertEqual(
             appOutput,
             output,
             msg=
             "delete() method does not delete the note specified by index")
コード例 #3
0
            "Enter 2 to list all notes.\n"
            "Enter 3 to get a specific note.\n"
            "Enter 4 to search notes for a string.\n"
            "Enter 5 to delete a specific note.\n"
            "Enter 6 to edit a specific note.\n"
            "Enter 0 to exit Application.\n\n>>> "
        )
    )
    if userInput == 1:
        methodArgument = input("Enter new content:")
        noteObject.create(methodArgument)
    elif userInput == 2:
        noteObject.list()
    elif userInput == 3:
        methodArgument = input("Enter index for the specific note you want " "from the list: ")
        noteObject.get(int(methodArgument))
    elif userInput == 4:
        methodArgument = input("Enter your search string: ")
        noteObject.search(methodArgument)
    elif userInput == 5:
        methodArgument = input("What is the index of the note you want to " "remove: ")
        noteObject.delete(int(methodArgument))
    elif userInput == 6:
        methodArgumentOne = input("What is the index of the note you want to" "remove: ")
        methodArgumentTwo = input("What do you want to replace it with: ")
        noteObject.edit(int(methodArgumentOne), methodArgumentTwo)
    elif userInput == 0:
        print("You have successfully exited the Application")
    else:
        print("You entered an invalid input.")
コード例 #4
0
		               		"Enter 0 to exit Application.\n\n>>> "
	                ))
	if userInput == 1:
		methodArgument = input("Enter new content:")
		noteObject.create(methodArgument)
	elif userInput == 2:
		noteObject.list()
	elif userInput == 3:
		methodArgument = input("Enter index for the specific note you want "
								"from the list: "
							)
		noteObject.get(int(methodArgument))
	elif userInput == 4:
		methodArgument = input("Enter your search string: ")
		noteObject.search(methodArgument)
	elif userInput == 5:
		methodArgument = input("What is the index of the note you want to "
								"remove: "
							)
		noteObject.delete(int(methodArgument))
	elif userInput == 6:
		methodArgumentOne = input("What is the index of the note you want to"
									"remove: "
								)
		methodArgumentTwo = input("What do you want to replace it with: ")
		noteObject.edit(int(methodArgumentOne), methodArgumentTwo)
	elif userInput == 0:
		print("You have successfully exited the Application")
	else:
		print("You entered an invalid input.")