docstr: Prior to plotly.js 1.43.0 title properties were strings, in 1.43.0
  these title properties became compound objects with a text property.
  
  For backwards compatibility, we still need to support setting this
  title object as a string or number
docstr_tok: ["Prior","to","plotly.js","1.43.0","title","properties","were","strings",",","in","1.43.0","these","title","properties","became","compound","objects","with","a","text","property",".","For","backwards","compatibility",",","we","still","need","to","support","setting","this","title","object","as","a","string","or","number"]
code: def test_title_as_string_layout(self):
      """
      Prior to plotly.js 1.43.0 title properties were strings, in 1.43.0
      these title properties became compound objects with a text property.
  
      For backwards compatibility, we still need to support setting this
      title object as a string or number
      """
      layout_title_parents = [
          go.Layout(),
          go.layout.XAxis(),
          go.layout.YAxis(),
          go.layout.ternary.Aaxis(),
          go.layout.ternary.Baxis(),
          go.layout.ternary.Caxis(),
          go.layout.scene.XAxis(),
          go.layout.scene.YAxis(),
          go.layout.scene.ZAxis(),
          go.layout.polar.RadialAxis(),
          go.scatter.marker.ColorBar(),
          go.cone.ColorBar(),
      ]
  
      for obj in layout_title_parents:
          obj.title = "A title"
  
          self.assertEqual(obj.title.text, "A title")
          self.assertEqual(
              obj.to_plotly_json(), {"title": {"text": "A title"}}
          )
  
          # And update
          obj.update(title="A title 2")
          self.assertEqual(obj.title.text, "A title 2")
          self.assertEqual(
              obj.to_plotly_json(), {"title": {"text": "A title 2"}}
          )
  
          # Update titlefont
          obj.update(titlefont={"size": 23})
          self.assertEqual(obj.title.font.size, 23)
          self.assertEqual(
              obj.to_plotly_json(),
              {"title": {"text": "A title 2", "font": {"size": 23}}},
          )
  
      # Pie
      obj = go.Pie()
      obj.title = "A title"
      self.assertEqual(obj.title.text, "A title")
      self.assertEqual(
          obj.to_plotly_json(),
          {"title": {"text": "A title"}, "type": "pie"},
      )
  
      # And update
      obj.update(title="A title 2")
      self.assertEqual(obj.title.text, "A title 2")
      self.assertEqual(
          obj.to_plotly_json(),
          {"type": "pie", "title": {"text": "A title 2"}},
      )
  
      # Update titlefont
      obj.update(titlefont={"size": 23})
      self.assertEqual(obj.title.font.size, 23)
      self.assertEqual(
          obj.to_plotly_json(),
          {
              "type": "pie",
              "title": {"text": "A title 2", "font": {"size": 23}},
          },
      )
  
file_path: plotly.py/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_graph_objs.py
imports: from unittest import TestCase
  import plotly.graph_objs
label_desc: Use image node_id 2 for calling the TestBackwardsCompat obj's underlying member method code with example usage: obj.test_title_as_string_layout() without return types