refactoring of function_test.py