Style fixes.

Use setup and teardown functions in tests and fix incorrect indentation.