Sorry for not posting anything for a long time, but I’ve caught a terrible cold.
Anyway, I’d like to wish you a Merry Christmas and a Happy New Year! I also wish you health, fast
SELECTs, interesting projects and
raise_salary being called for you often!
Unit Testing in Python Using unittest Module
The goal of this article is to provide a quick introduction to Python’s unit testing module called unittest. It is the essence, the very basic information you need to quickly start unit testing in Python.
Introduction to the unittest Module
Key points about unit testing in Python:
- modules with tests should import
- tests should be defined inside a class extending the
- every test should start with the
- if a test has a doc. comment (between a pair of
''', i. e. three apostrophes), the comment will be printed when the test is being run (if verbose mode was set),
- tests can have
tearDown methods – those methods will be called, respectively, before and after each of the tests; there are also class-level set up and tear down methods,
- to execute the tests when the module is run,
unittest.main() should be called,
- to see which tests are called with additional info, the
-v (verbose) parameter should be specified when the module with tests is executed.
The man in black fled across the desert, and the gunslinger followed.
Stephen King – The Dark Tower I – The Gunslinger
I have finally started my blog. It took me a long, long time, but here I am, and I welcome you.
Why another technical blog, you may ask?
Not a long time after I have started learning programming did I find out that there is an answer to almost any question I had about programming, or a solution to a problem I had faced, somewhere over there, in the corners of the Universe… Internet, I mean. Continue reading