Fix tests for py3 and py2.6