code: def test_menu(self):
      items = ("a", "b", "c")
      default = "a"
      optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items)
      found_default = False
      for i in range(len(items)):
          value = optmenu["menu"].entrycget(i, "value")
          self.assertEqual(value, items[i])
          if value == default:
              found_default = True
      self.assertTrue(found_default)
      optmenu.destroy()
  
      # default shouldn't be in menu if it is not part of values
      default = "d"
      optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items)
      curr = None
      i = 0
      while True:
          last, curr = curr, optmenu["menu"].entryconfigure(i, "value")
          if last == curr:
              # no more menu entries
              break
          self.assertNotEqual(curr, default)
          i += 1
      self.assertEqual(i, len(items))
  
      # check that variable is updated correctly
      optmenu.pack()
      optmenu.wait_visibility()
      optmenu["menu"].invoke(0)
      self.assertEqual(optmenu._variable.get(), items[0])
  
      # changing to an invalid index shouldn't change the variable
      self.assertRaises(tkinter.TclError, optmenu["menu"].invoke, -1)
      self.assertEqual(optmenu._variable.get(), items[0])
  
      optmenu.destroy()
  
      # specifying a callback
      success = []
  
      def cb_test(item):
          self.assertEqual(item, items[1])
          success.append(True)
  
      optmenu = ttk.OptionMenu(
          self.root, self.textvar, "a", command=cb_test, *items
      )
      optmenu["menu"].invoke(1)
      if not success:
          self.fail("Menu callback not invoked")
  
      optmenu.destroy()
  
imports: import sys
  import unittest
  import Tkinter
  import ttk
  from test.test_support import requires, run_unittest, swap_attr
  from test_ttk.support import AbstractTkTest, destroy_default_root
label_desc: Use image node_id 5 for calling the OptionMenuTest obj's underlying member method code with example usage: obj.test_menu() without return types