class_docstr: Tests for the ExpandingButton class.
class_docstr_tok: ["Tests","for","the","ExpandingButton","class","."]
docstr: Test the copy event.
docstr_tok: ["Test","the","copy","event","."]
code: def test_copy(self):
      """Test the copy event."""
      # Testing with the actual clipboard proved problematic, so this
      # test replaces the clipboard manipulation functions with mocks
      # and checks that they are called appropriately.
      squeezer = self.make_mock_squeezer()
      expandingbutton = ExpandingButton("TEXT", "TAGS", 50, squeezer)
      expandingbutton.clipboard_clear = Mock()
      expandingbutton.clipboard_append = Mock()
  
      # Trigger the copy event.
      retval = expandingbutton.copy(event=Mock())
      self.assertEqual(retval, None)
  
      # Vheck that the expanding button called clipboard_clear() and
      # clipboard_append('TEXT') once each.
      self.assertEqual(expandingbutton.clipboard_clear.call_count, 1)
      self.assertEqual(expandingbutton.clipboard_append.call_count, 1)
      expandingbutton.clipboard_append.assert_called_with("TEXT")
  
imports: from textwrap import dedent
  from tkinter import Text, Tk
  import unittest
  from unittest.mock import Mock, NonCallableMagicMock, patch, sentinel, ANY
  from test.support import requires
  from idlelib.config import idleConf
  from idlelib.percolator import Percolator
  from idlelib.squeezer import count_lines_with_wrapping, ExpandingButton, Squeezer
  from idlelib import macosx
  from idlelib.textview import view_text
  from idlelib.tooltip import Hovertip
label_desc: Use image node_id 5 for calling the ExpandingButtonTest obj's underlying member method code with example usage: obj.test_copy() without return types