Fix mode test for Python3.