Fix some Python version compatability problems in the tests.