Test print / standard output
Level: Beginner (score: 2)
We moved from mutpy
(<= 3.7) to mutatest
(3.12 📈) for test Bites.
First we check if you have 90% test coverage, then we inject some mutations into the code to see if your tests catch them. 🤯
Good luck 🔥 💪 (please be patient 🙏 - it can take a few seconds to run the tests 🕒)
In this Bite you test a function that prints to stdout. Check out pytest
's Capturing of the stdout/stderr output how to test this.
You probably want to use the capsys
/ capfd
fixture in your test code and you'll probably find a good use case for @pytest.mark.parametrize here too.
Have fun and keep calm and code in Python!