More Pythonic test code