Handle bytes in test for Py2 and 3