code: def test_calc_n_jobs():
      # make a random big DataFrame
      df = pd.DataFrame(
          np.random.random((np.power(10, 8), 4)),
          columns=["A", "B", "C", "D"],
      )
      n_grids = 10
      n_jobs = 4
      prev_n_jobs = 4
  
      # memory_limit = 0.5, true_n_jobs = 4
      # memory_limit = 0.4, true_n_jobs = 4
      # memory_limit = 0.3, true_n_jobs = 4
      # memory_limit = 0.2, true_n_jobs = 3
      # memory_limit = 0.1, true_n_jobs = 1
      for memory_limit in [0.5, 0.4, 0.3, 0.2, 0.1]:
          true_n_jobs = _calc_n_jobs(df, n_grids, memory_limit, n_jobs)
          assert isinstance(true_n_jobs, int)
          assert true_n_jobs >= 1
          assert true_n_jobs <= prev_n_jobs
          prev_n_jobs = true_n_jobs
  
imports: import pandas
  import numpy
  import pytest
  from pdpbox.utils import FeatureInfo, _to_rgba, _check_col, _check_dataset, _make_list, _check_model, _check_classes, _check_memory_limit, _check_frac_to_plot, _calc_n_jobs, _get_string, _expand_params_for_interact, _calc_preds, _check_cluster_params, _check_plot_engine, _check_pdp_interact_plot_type
label_desc: Use image node_id 8 for calling a global function with example usage: test_calc_n_jobs() without return types