code: def _create_test_data():
      """Create test data to local folder.
  
      This function is needed when test data needs to be updated.
      """
      import platform
      import shutil
      from pathlib import Path
  
      import cmdstanpy
  
      model_code = """
          data {
              int<lower=0> J;
              real y[J];
              real<lower=0> sigma[J];
          }
  
          parameters {
              real mu;
              real<lower=0> tau;
              real eta[2, J / 2];
          }
  
          transformed parameters {
              real theta[J];
              for (j in 1:J/2) {
                  theta[j] = mu + tau * eta[1, j];
                  theta[j + 4] = mu + tau * eta[2, j];
              }
          }
  
          model {
              mu ~ normal(0, 5);
              tau ~ cauchy(0, 5);
              eta[1] ~ normal(0, 1);
              eta[2] ~ normal(0, 1);
              y ~ normal(theta, sigma);
          }
  
          generated quantities {
              vector[J] log_lik;
              vector[J] y_hat;
              for (j in 1:J) {
                  log_lik[j] = normal_lpdf(y[j] | theta[j], sigma[j]);
                  y_hat[j] = normal_rng(theta[j], sigma[j]);
              }
          }
      """
      stan_file = "stan_test_data.stan"
      with open(stan_file, "w", encoding="utf8") as file_handle:
          print(model_code, file=file_handle)
      model = cmdstanpy.CmdStanModel(stan_file=stan_file)
      os.remove(stan_file)
      stan_data = {
          "J": 8,
          "y": np.array([28.0, 8.0, -3.0, 7.0, -1.0, 1.0, 18.0, 12.0]),
          "sigma": np.array(
              [15.0, 10.0, 16.0, 11.0, 9.0, 11.0, 10.0, 18.0]
          ),
      }
      fit_no_warmup = model.sample(
          data=stan_data,
          iter_sampling=100,
          iter_warmup=1000,
          save_warmup=False,
      )
      fit_no_warmup.save_csvfiles(dir=".")
      fit_files = {
          "cmdstanpy_eight_schools_nowarmup": [],
          "cmdstanpy_eight_schools_warmup": [],
      }
      for path in fit_no_warmup.runset.csv_files:
          path = Path(path)
          _, num = path.stem.rsplit("-", 1)
          new_path = path.parent / (
              "cmdstanpy_eight_schools_nowarmup-" + num + path.suffix
          )
          shutil.move(path, new_path)
          fit_files["cmdstanpy_eight_schools_nowarmup"].append(new_path)
      fit_warmup = model.sample(
          data=stan_data,
          iter_sampling=100,
          iter_warmup=500,
          save_warmup=True,
      )
      fit_warmup.save_csvfiles(dir=".")
      for path in fit_no_warmup.runset.csv_files:
          path = Path(path)
          _, num = path.stem.rsplit("-", 1)
          new_path = path.parent / (
              "cmdstanpy_eight_schools_warmup-" + num + path.suffix
          )
          shutil.move(path, new_path)
          fit_files["cmdstanpy_eight_schools_warmup"].append(new_path)
      path = Path(stan_file)
      os.remove(
          str(
              path.parent
              / (
                  path.stem
                  + (".exe" if platform.system() == "Windows" else "")
              )
          )
      )
      os.remove(str(path.parent / (path.stem + ".hpp")))
      return fit_files
  
imports: import os
  import sys
  import tempfile
  from glob import glob
  import numpy
  import pytest
  from ...None import from_cmdstanpy
  from ..helpers import chains, check_multiple_attrs, draws, eight_schools_params, importorskip, load_cached_models, pystan_version
label_desc: Use image node_id 1 for calling a global function with example usage: _create_test_data() and returns: fit_files