class_docstr: These tests don't spawn children or hang.
docstr: Test the normal data case on both master_fd and stdin.
docstr_tok: ["Test","the","normal","data","case","on","both","master_fd","and","stdin","."]
code: def test__copy_to_each(self):
      """Test the normal data case on both master_fd and stdin."""
      read_from_stdout_fd, mock_stdout_fd = self._pipe()
      pty.STDOUT_FILENO = mock_stdout_fd
      mock_stdin_fd, write_to_stdin_fd = self._pipe()
      pty.STDIN_FILENO = mock_stdin_fd
      socketpair = self._socketpair()
      masters = [s.fileno() for s in socketpair]
  
      # Feed data.  Smaller than PIPEBUF.  These writes will not block.
      write_all(masters[1], b"from master")
      write_all(write_to_stdin_fd, b"from stdin")
  
      # Expect three select calls, the last one will cause IndexError
      pty.select = self._mock_select
      self.select_input.append(([mock_stdin_fd, masters[0]], [], []))
      self.select_output.append(([mock_stdin_fd, masters[0]], [], []))
      self.select_input.append(
          (
              [mock_stdin_fd, masters[0]],
              [mock_stdout_fd, masters[0]],
              [],
          )
      )
      self.select_output.append(([], [mock_stdout_fd, masters[0]], []))
      self.select_input.append(([mock_stdin_fd, masters[0]], [], []))
  
      with self.assertRaises(IndexError):
          pty._copy(masters[0])
  
      # Test that the right data went to the right places.
      rfds = select.select(
          [read_from_stdout_fd, masters[1]], [], [], 0
      )[0]
      self.assertEqual([read_from_stdout_fd, masters[1]], rfds)
      self.assertEqual(os.read(read_from_stdout_fd, 20), b"from master")
      self.assertEqual(os.read(masters[1], 20), b"from stdin")
  
imports: from test.support import verbose, reap_children
  from test.support.import_helper import import_module
  import errno
  import os
  import pty
  import tty
  import sys
  import select
  import signal
  import socket
  import io
  import unittest
  import warnings
label_desc: Use image node_id 8 for calling the SmallPtyTests obj's underlying member method code with example usage: obj.test__copy_to_each() without return types