Fixed #111 - Removes Python error.

Added test to check it works.
Added tests to address issue #123.
Refactored tests code.

Mostly PEP8, but also redundant asserts.