I have this function that asks the user for the gender of the voice and then reads the text in that voice. If the user input is not either male or female it raises a value error. I want to write a unit test for this function, but don't know how exactly I can do that.
def pdftospeech(n):
readersvoice = input("Voice: ").lower().strip()
voices = engine.getProperty("voices")
if readersvoice == "female":
engine.setProperty("voice", voices[1].id)
elif readersvoice == "male":
engine.setProperty("voice", voices[0].id)
else:
raise ValueError("Choose from male or female")
engine.setProperty("rate", 150)
rate = engine.getProperty("rate")
engine.say(n)
engine.runAndWait()