Fix tests so they are compatible with python 3.x