Update test functions with shorter error message and cleaned up formatting