code: def test_to_terminated_truncated_step_api(
      is_vector_env,
      terminated_truncated_returns,
      expected_done,
      expected_truncated,
  ):
      _, _, done, info = convert_to_done_step_api(
          terminated_truncated_returns, is_vector_env=is_vector_env
      )
      assert np.all(done == expected_done)
  
      if is_vector_env is False:
          if expected_done:
              assert info["TimeLimit.truncated"] == expected_truncated
          else:
              assert "TimeLimit.truncated" not in info
      elif isinstance(info, list):
          for sub_info, env_done, env_truncated in zip(
              info, expected_done, expected_truncated
          ):
              if env_done:
                  assert (
                      sub_info["TimeLimit.truncated"] == env_truncated
                  )
              else:
                  assert "TimeLimit.truncated" not in sub_info
      else:  # isinstance(info, dict)
          if np.any(expected_done):
              assert np.all(
                  info["TimeLimit.truncated"] == expected_truncated
              )
          else:
              assert "TimeLimit.truncated" not in info
  
      roundtripped_returns = convert_to_terminated_truncated_step_api(
          (0, 0, done, info), is_vector_env=is_vector_env
      )
      assert data_equivalence(
          terminated_truncated_returns, roundtripped_returns
      )
  
imports: import numpy
  import pytest
  from gym.utils.env_checker import data_equivalence
  from gym.utils.step_api_compatibility import convert_to_done_step_api, convert_to_terminated_truncated_step_api
label_desc: Use image node_id 2 for calling a global function with example usage: test_to_terminated_truncated_step_api(is_vector_env, terminated_truncated_returns, expected_done, expected_truncated) without return types