I want to ask if I should include the function that I am testing inside the unittest file (such that I will have one file, unittest.py), or I should just import it in the unittest file (I will have two files, unittest.py and function.py). I am seeing both methods when I read in the web, however I find the first testing that I described as redundant.
Share
Two separate files of course. The idea is the unit test should be non-intrusive and should sit in the own file, usually clearly put under a test directory and/or named test_*. I have never seen people put it in the same file unless it is the most trivial demo.