def METHOD_NAME(fortran_reader):
    '''Test that fparser2 Part_Ref is converted to the expected PSyIR
    tree structure when there is a function. The function will be a
    part_ref but will have a RoutineSymbol.
    '''
    code = (
        "module test_mod\n"
        "contains\n"
        "  subroutine test_sub()\n"
        "    integer :: a\n"
        "    integer :: i\n"
        "    a = test_func(i)\n"
        "  end subroutine\n"
        "  integer function test_func(i)\n"
        "    integer :: i\n"
        "    test_func = i\n"
        "  end function test_func\n"
        "end module\n")
    psyir = fortran_reader.psyir_from_source(code)
    function = psyir.children[0].children[1]
    assert isinstance(function, Routine)
    assert isinstance(function.return_symbol, DataSymbol)
    assert isinstance(function.return_symbol.datatype, ScalarType)
    call = psyir.children[0].children[0].children[0].rhs
    assert isinstance(call, Call)
    assert call.routine.name == "test_func"
    symbol = call.scope.symbol_table.lookup("test_func")
    assert isinstance(symbol, RoutineSymbol)
    assert isinstance(symbol.datatype, ScalarType)
    assert symbol.datatype is function.return_symbol.datatype