Fixed py3 compatibility in tests.