TST: Moved test functions to module level. #8023