code: def test_described_subscript_error_on_type_error(some_fig):
      # The above tests for subscripting errors did not test for when we attempt
      # to subscript an object that is not None, such as a string or a number.
      # These do that.
      raised = False
      try:
          # Trying to address with a key an object that doesn't support it (as we
          # do below) reports an error listing what are valid assignments to the
          # object, like when we try and assign a number to something that expects as string.
          some_fig["layout_template_layout_plot_bgcolor"] = 1
      except ValueError as e:
          raised = True
          # Trim off the beginning of the error string because it is related to
          # trying to assign a number to something expecting a string, whereas
          # below the error will be due to trying to subscript something that
          # doesn't support it. But the list of valid properties should be shown
          # for both errors and this is what we extract.
          # Trimmed like this because this string is different in Python2 than
          # Python3
          e_correct_substr = e.args[0]
          start_at = e_correct_substr.find("    The 'plot_bgcolor'")
          e_correct_substr = e_correct_substr[start_at:]
          e_correct_substr += """
  
  Property does not support subscripting:
  template_layout_plot_bgcolor_x
                  ^^^^^^^^^^^^"""
      assert raised
      raised = False
      try:
          some_fig.update_layout(template_layout_plot_bgcolor_x=1)
      except ValueError as e:
          raised = True
          print(e.args[0])
          e_substr = error_substr(
              e.args[0],
              """string indices must be integers
  
  Invalid value received for the 'plot_bgcolor' property of layout
  
  """,
          )
          assert e_substr == e_correct_substr
      assert raised
  
imports: import plotly.graph_objects
  from _plotly_utils.exceptions import PlotlyKeyError
  import pytest
label_desc: Use image node_id 8 for calling a global function with example usage: test_described_subscript_error_on_type_error(some_fig) without return types