many fixes

Many changes, including:

* fix several bugs introduced by Python rewrite
* add tests for `changesgenerate` functionality
* apply PEP8 to tests, not just `tar_scm.py`