Fix tests on Python 2

They were running on Python 3 but not on 2.