Got tests working

* Fixed sensitivity to local timezone.
* Works with Python 3.3.
* PEP8 and pyflakes tidy up.