assert vs == for testing code in Python?
<p>What is the need for importing unittest and running assertTrue (for example) while testing a python function instead of writing a usual python function with == True check for testing? What is the new thing about unittesting, as even the test cases have to be written by user, which can be checked by == instead of assert family of functions in unittest? My question basically is: assert in unittest vs the equality check operation == in Python.</p>

<p>I would say that the most interesting thing is the "easy-to-test" that the unittest package (as well as others, for example pytest) provides. When using unittest you can just run a command and check if your refactoring or your last feature broke something on the rest of the program. I would read something about <a href="https://en.wikipedia.org/wiki/Test-driven_development" rel="nofollow">test-driven development</a> to understand better what is the importance of unittesting. </p>

python python-2.7 unit-testing testing tdd