I would like to simulate inputs from the user in unittest using Python 3.8. I have a function that first asks the user which program to execute and then multiple other inputs to get the required values for the said app. I would like to simulate these inputs (input()) in unittest. I was unable to find an answer from this post, as that answer uses "inputted" text and then plugs it into a function, and does not work seamlessly with input(). I would like a solution that works seamlessly with input(), as if a human was running the program, and returns the values that the function in the program outputs. Using separate functions is very tedious and would mean updating the program twice, which is not ideal. If it the only way, I am willing to deal with it, but I would prefer not to. Here is some code that will need to be tested.
main.py:
import numworksLibs
def page1():
if (prgrmchoice == "1"):
numer = int(input("Enter the Numerator of the Fraction: "))
denom = int(input("Enter the Denominator of the Fraction: "))
numworksLibs.simplify_fraction(numer, denom)
And the library file takes this input and spits out an answer (numworksLibs.py).