Add docstrings to tests. Make some tests smaller by moving code to separate test cases.