Fix tests to pass on Python 3