code: def test_parser(data, tmpdir):
      parser = SimpleParser(data)
  
      cache_filepath = Path(tmpdir / "simple_parser.pkl")
      records = parser.parse(data_splitter=SingleSplitSplitter())[0]
      assert cache_filepath.exists() == False
      assert len(records) == 2
  
      record = records[1]
      # assert set(record.keys()) == {
      #     "class_map",
      #     "record_id",
      #     "filepath",
      #     "height",
      #     "width",
      #     "labels",
      #     "bboxes",
      # }
      assert record.record_id == 42
      assert record.filepath == Path(__file__)
      assert len(record.detection.class_map) == 3
      assert record.detection.class_map.get_by_name("background") == 0
      assert record.detection.class_map.get_by_id(0) == "background"
      assert record.detection.label_ids == [1, 2]
      assert record.detection.bboxes == [
          BBox.from_xyxy(1, 2, 3, 4),
          BBox.from_xyxy(10, 20, 30, 40),
      ]
  
      assert parser._check_path() == False
      assert parser._check_path(cache_filepath) == False
      records = parser.parse(
          data_splitter=SingleSplitSplitter(),
          cache_filepath=cache_filepath,
      )[0]
      assert parser._check_path(cache_filepath) == True
      assert cache_filepath.exists() == True
      loaded_records = pickle.load(open(cache_filepath, "rb"))[0]
      assert len(loaded_records) == len(records)
      for loaded_record, record in zip(loaded_records, records):
          assert loaded_record.filepath == record.filepath
          assert (
              loaded_record.detection.label_ids
              == record.detection.label_ids
          )
          assert (
              loaded_record.detection.bboxes == record.detection.bboxes
          )
  
      parser = SimpleParser(data)
      assert len(parser.class_map) == 3
      assert parser.class_map._lock == True
  
file_path: icevision/tests/parsers/test_parser.py
imports: import pytest
  from icevision.all import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_parser(data, tmpdir) without return types