code: def test_save_warmup_issue_1208_after_3_9(self):
      with pm.Model():
          pm.Uniform("u1")
          pm.Normal("n1")
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore",
                  "Tuning samples will be included.*",
                  UserWarning,
              )
              trace = pm.sample(
                  tune=100,
                  draws=200,
                  chains=2,
                  cores=1,
                  step=pm.Metropolis(),
                  discard_tuned_samples=False,
                  return_inferencedata=False,
              )
          assert isinstance(trace, pm.backends.base.MultiTrace)
          assert len(trace) == 300
  
          # from original trace, warmup draws should be separated out
          idata = to_inference_data(trace, save_warmup=True)
          test_dict = {
              "posterior": ["u1", "n1"],
              "sample_stats": ["~tune", "accept"],
              "warmup_posterior": ["u1", "n1"],
              "warmup_sample_stats": ["~tune", "accept"],
          }
          fails = check_multiple_attrs(test_dict, idata)
          assert not fails
          assert idata.posterior.sizes["chain"] == 2
          assert idata.posterior.sizes["draw"] == 200
  
          # manually sliced trace triggers the same warning as <=3.8
          with pytest.warns(UserWarning, match="Warmup samples"):
              idata = to_inference_data(trace[-30:], save_warmup=True)
          test_dict = {
              "posterior": ["u1", "n1"],
              "sample_stats": ["~tune", "accept"],
              "~warmup_posterior": [],
              "~warmup_sample_stats": [],
          }
          fails = check_multiple_attrs(test_dict, idata)
          assert not fails
          assert idata.posterior.sizes["chain"] == 2
          assert idata.posterior.sizes["draw"] == 30
  
imports: import warnings
  from typing import Dict, Tuple
  import numpy
  import pytensor.tensor
  import pytest
  from arviz import InferenceData
  from arviz.tests.helpers import check_multiple_attrs
  from numpy import ma
  from pytensor.tensor.subtensor import AdvancedIncSubtensor, AdvancedIncSubtensor1
  import pymc
  from pymc.backends.arviz import InferenceDataConverter, predictions_to_inference_data, to_inference_data
  from pymc.exceptions import ImputationWarning
label_desc: Use image node_id 2 for calling the TestPyMCWarmupHandling obj's underlying member method code with example usage: obj.test_save_warmup_issue_1208_after_3_9() without return types