Fix tests on Python 2