code: def test_titles(self):
      widget = self.widget(self.children, selected_index=None)
      assert widget.get_state()["titles"] == ("", "")
      assert widget.titles == ("", "")
  
      widget.set_title(1, "Title 1")
      assert widget.get_state()["titles"] == ("", "Title 1")
      assert widget.titles[1] == "Title 1"
      assert widget.get_title(1) == "Title 1"
  
      # Backwards compatible with 7.x api
      widget.set_title(1, None)
      assert widget.get_state()["titles"] == ("", "")
      assert widget.titles[1] == ""
      assert widget.get_title(1) == ""
  
      with self.assertRaises(IndexError):
          widget.set_title(2, "out of bounds")
      with self.assertRaises(IndexError):
          widget.get_title(2)
  
      widget.children = tuple(widget.children[:1])
      assert len(widget.children) == 1
      assert widget.titles == ("",)
  
imports: from unittest import TestCase
  from traitlets import TraitError
  from ipywidgets.widgets import Accordion, Tab, Stack, HTML
label_desc: Use image node_id 7 for calling the TestTab obj's underlying member method code with example usage: obj.test_titles() without return types