Fix unit tests to be Python 3 compatible