NPRG065: Programming in Python - D3S
NPRG065: Programming in Python Lecture 13
Tomas Bures Petr Hnetynka
{bures,hnetynka}@d3s.mff.cuni.cz
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics
Unit testing
2
Unit testing
unit testing
testing "small" units of functionality a unit ? independent on other ones tests are separated
creating helper objects for tests
context
typically in OO languages
unit ~ method
ideally ? unit tests for all units in a program
typically in OO languages
for all public methods
3
Unit testing in Python
Modules in std. library
doctest unittest
4
doctest
Placing testing code in pydoc comments
def echo(value): """ Documentation here
Code to be executed as a test
>>> echo(0) 0 """ return value
Expected value of the test
Executing tests
python -m doctest -v example.py
Or
placing doctest.testmod() to "main" and executing the
module with the argument -v
See
doctesting.py
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- nprg065 programming in python d3s
- 1 field guide getting started with pathlib
- arcpy tips tricks esri
- python pillow tutorialspoint
- programming principles in python csci 503
- python yaml package documentation
- bringing your python
- pysox documentation
- optimizations which made python 3 6 faster than python 3 5
- python testing with pytest second edition
Related searches
- macro programming in excel
- programming in excel
- programming in java pdf
- sort dictionary in python by values
- programming in matlab
- object oriented programming in matlab
- programming in basic
- database programming in java
- database programming in python
- run python script in python shell
- object oriented programming in python
- python programming in visual studio