Replace raw asserts with unittest.assert* and a bit of pep8 cleanup