Fix tests under Python 3