TST: make testing function more flexible