code: def test_segments(self):
      sb = SArrayBuilder(int, num_segments=4)
  
      sb.append_multiple((i for i in range(20, 30)), segment=2)
      sb.append_multiple((i for i in range(10, 20)), segment=1)
      sb.append_multiple((i for i in range(30, 40)), segment=3)
      sb.append_multiple((i for i in range(0, 10)), segment=0)
  
      hist = sb.read_history(3, segment=0)
      self.assertSequenceEqual(hist, [7, 8, 9])
      hist = sb.read_history(3, segment=1)
      self.assertSequenceEqual(hist, [17, 18, 19])
      hist = sb.read_history(3, segment=2)
      self.assertSequenceEqual(hist, [27, 28, 29])
      hist = sb.read_history(3, segment=3)
      self.assertSequenceEqual(hist, [37, 38, 39])
  
      with self.assertRaises(RuntimeError):
          sb.read_history(3, segment=99)
  
      sa = sb.close()
      self.__test_equal(sa, range(40), int)
  
file_path: turicreate/src/python/turicreate/test/test_sarray_builder.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from ..data_structures.sarray_builder import SArrayBuilder
  import unittest
  import array
  import datetime
  from .._cython.cy_flexible_type import GMT
  import pytest
label_desc: Use image node_id 6 for calling the SArrayBuilderTest obj's underlying member method code with example usage: obj.test_segments() without return types