code: def test_iter(runhistory, config1):
      """Test that iter goes in the order of insertion and has consitent length
      with the runhistory's advertised length and it's internal `data`
      """
      params = [
          {"instance": "a", "cost": 1.0},
          {"instance": "b", "cost": 2.0},
          {"instance": "c", "cost": 3.0},
          {"instance": "d", "cost": 4.0},
      ]
  
      for p in params:
          add_item(runhistory, config1, **p)
  
      expected_id_order = [p["instance"] for p in params]
      assert [k.instance for k in iter(runhistory)] == expected_id_order
  
      assert len(list(iter(runhistory))) == len(runhistory)
      assert len(list(iter(runhistory))) == len(runhistory._data)
  
imports: from __future__ import annotations
  import os
  import pickle
  import tempfile
  import pytest
  from smac.runhistory.runhistory import RunHistory, TrialKey
  from smac.runner.abstract_runner import StatusType
label_desc: Use image node_id 19 for calling a global function with example usage: test_iter(runhistory, config1) without return types