I have this simple program in Python (hello.py
):
name=input()
print("Hello " + name)
As simple as that, no classes, no functions, no nothing, just an input and the corresponding output.
My aim is just to create test_hello.py
, a test file for hello.py
. I spend a few hours searching on the internet, but I only found unit tests for functions or methods but not for a simple input and output program. Any clue? Thank you a lot in advance!
Note: Stack overflow suggests that there is an answer: How to assert output with nosetest/unittest in python?
But the two questions are very different, there aren't functions in my code and there is an input()
. In the "answer" suggested the code is inside a function and there is no input()
.