Fix tests in Python 3