Fix ticklabels test on Python 3