Fix tests on Python 3.
Fixed tests in Python 3.