code: def test_map_function_runs_once():
      df = DataFrame({"a": [1, 2, 3]})
      values = []  # Save values function is applied to
  
      def reducing_function(val):
          values.append(val)
  
      def non_reducing_function(val):
          values.append(val)
          return val
  
      for func in [reducing_function, non_reducing_function]:
          del values[:]
  
          df.map(func)
          assert values == df.a.to_list()
  
imports: from datetime import datetime
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Series, Timestamp, date_range
  import pandas._testing
  from pandas.tseries.offsets import BDay
label_desc: Use image node_id 12 for calling a global function with example usage: test_map_function_runs_once() and returns: val