Clean up tests

Make them somewhat clearer and simpler.
Flake8 fixes