I am creating a Full-Screen TUI app using python-prompt-toolkit
(https://github.com/prompt-toolkit/python-prompt-toolkit)
- I don't know how to make a unittests for it.
Example Code:
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/examples/full-screen/full-screen-demo.py
I managed to do so using
unittestmaking two sperate files >> test.py , run_tests.py1- putting the prompt-toolkit output in a function like so in
test.pyIn this way, I am accessing the real output of the prompt-toolkit lib for my custom widget (can be done for any type of widget)
2- test it by the expected output in run_tests.py
I dont know if there is an other valid way to do so, but this way worked for me.