make tests compatible with python3

Those changes are allowing tests.py to run smoothly in python 3.