Make tests.py compatible with Python 3