Fix test to work in Python 2 and 3.