Update tests.py

Without fix fails with `TypeError: Type str doesn't support the buffer API` in Python 3.