Helper function in tests.

Great job, I found your set very useful!

This is just a part of refactoring, I hope you get the idea and find it nice :)