add python tests
improve error reporting