Make test script Python 3-compatible