TST: fix test errors on Python 3