Fix test Python 3 compatibility.