code: def test_sequence():
      cstats = ConstructorStats.get(m.Sequence)
  
      s = m.Sequence(5)
      assert cstats.values() == ["of size", "5"]
  
      assert "Sequence" in repr(s)
      assert len(s) == 5
      assert s[0] == 0 and s[3] == 0
      assert 12.34 not in s
      s[0], s[3] = 12.34, 56.78
      assert 12.34 in s
      assert s[0] == approx(12.34, rel=1e-05)
      assert s[3] == approx(56.78, rel=1e-05)
  
      rev = reversed(s)
      assert cstats.values() == ["of size", "5"]
  
      rev2 = s[::-1]
      assert cstats.values() == ["of size", "5"]
  
      it = iter(m.Sequence(0))
      for _ in range(
          3
      ):  # __next__ must continue to raise StopIteration
          with pytest.raises(StopIteration):
              next(it)
      assert cstats.values() == ["of size", "0"]
  
      expected = [0, 56.78, 0, 0, 12.34]
      assert rev == approx(expected, rel=1e-05)
      assert rev2 == approx(expected, rel=1e-05)
      assert rev == rev2
  
      rev[0::2] = m.Sequence([2.0, 2.0, 2.0])
      assert cstats.values() == ["of size", "3", "from std::vector"]
  
      assert rev == approx([2, 56.78, 2, 0, 2], rel=1e-05)
  
      assert cstats.alive() == 4
      del it
      assert cstats.alive() == 3
      del s
      assert cstats.alive() == 2
      del rev
      assert cstats.alive() == 1
      del rev2
      assert cstats.alive() == 0
  
      assert cstats.values() == []
      assert cstats.default_constructions == 0
      assert cstats.copy_constructions == 0
      assert cstats.move_constructions >= 1
      assert cstats.copy_assignments == 0
      assert cstats.move_assignments == 0
  
file_path: coremltools/deps/pybind11/tests/test_sequences_and_iterators.py
imports: import pytest
  from pytest import approx
  from pybind11_tests import ConstructorStats
  from pybind11_tests import sequences_and_iterators
label_desc: Use image node_id 8 for calling a global function with example usage: test_sequence() without return types