Add initial tests and fix a problem.

- Not great test coverage but get some of the specific points.
- Fix one issue from the previous restructuring.
PEP8.
Hook up Travis config.