code: def test_stdin_broken_pipe(self):
      # buffer large enough to feed the whole pipe buffer
      large_data = b"x" * support.PIPE_MAX_SIZE
  
      rfd, wfd = os.pipe()
      self.addCleanup(os.close, rfd)
      self.addCleanup(os.close, wfd)
      if support.MS_WINDOWS:
          handle = msvcrt.get_osfhandle(rfd)
          os.set_handle_inheritable(handle, True)
          code = textwrap.dedent(
              f"""
                  import os, msvcrt
                  handle = {handle}
                  fd = msvcrt.open_osfhandle(handle, os.O_RDONLY)
                  os.read(fd, 1)
              """
          )
          from subprocess import STARTUPINFO
  
          startupinfo = STARTUPINFO()
          startupinfo.lpAttributeList = {"handle_list": [handle]}
          kwargs = dict(startupinfo=startupinfo)
      else:
          code = f"import os; fd = {rfd}; os.read(fd, 1)"
          kwargs = dict(pass_fds=(rfd,))
  
      # the program ends before the stdin can be fed
      proc = self.loop.run_until_complete(
          asyncio.create_subprocess_exec(
              sys.executable,
              "-c",
              code,
              stdin=subprocess.PIPE,
              **kwargs,
          )
      )
  
      async def write_stdin(proc, data):
          proc.stdin.write(data)
          # Only exit the child process once the write buffer is filled
          os.write(wfd, b"go")
          await proc.stdin.drain()
  
      coro = write_stdin(proc, large_data)
      # drain() must raise BrokenPipeError or ConnectionResetError
      with test_utils.disable_logger():
          self.assertRaises(
              (BrokenPipeError, ConnectionResetError),
              self.loop.run_until_complete,
              coro,
          )
      self.loop.run_until_complete(proc.wait())
  
imports: import os
  import signal
  import sys
  import textwrap
  import unittest
  import warnings
  from unittest import mock
  import asyncio
  from asyncio import base_subprocess
  from asyncio import subprocess
  from test.test_asyncio import utils
  from test import support
  from test.support import os_helper
label_desc: Use image node_id 10 for calling the SubprocessMixin obj's underlying member method code with example usage: obj.test_stdin_broken_pipe() without return types