Test-Driven Data Analysis Functions:
Level 0: WritableTestCase
is a subclass of unittest used to support
the creation of referene tests. These are like other tests except:
Level 1: the constraints
library is used to 'discover' constraints
from a (pandas) DataFrame, write them out as JSON, and to verify that
datasets meet the constraints in the constraints file. See the README
in the constraints
subdirectory for usage details.
Resources on these topics include:
Explanatory examples of how to use writabletestcase
are in the examples
subdirectory.
Use
cd examples
python test_using_writabletestcase.py
to run an example test.
See doc strings inside to see how to make the tests fail, then re-write the output.
Briefly: edit the generation functions in examples/generators.py
to generate different output, re-run the tests, see them fail, check
the output and then run
python test_using_writabletestcase.py -w
to re-write the reference output in examples/reference
,
after which if you run again with
python test_using_writabletestcase.py
Test tests should pass again.
Obviously, you should only rewrite the test output after carefully verifying the the changes are OK!
All examples, tests and code should run under Python2 and Python3.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.