Python 2.7 compatibility

I've made a few changes to one of the tests: now all tests pass on Python 2.7.