Clean up tests

Consolidate a mostly-duplicated test.

Add docstrings.