code: def testPair(self):
      kq = select.kqueue()
      a, b = socket.socketpair()
  
      a.send(b"foo")
      event1 = select.kevent(
          a,
          select.KQ_FILTER_READ,
          select.KQ_EV_ADD | select.KQ_EV_ENABLE,
      )
      event2 = select.kevent(
          b,
          select.KQ_FILTER_READ,
          select.KQ_EV_ADD | select.KQ_EV_ENABLE,
      )
      r = kq.control([event1, event2], 1, 1)
      self.assertTrue(r)
      self.assertFalse(r[0].flags & select.KQ_EV_ERROR)
      self.assertEqual(b.recv(r[0].data), b"foo")
  
      a.close()
      b.close()
      kq.close()
  
file_path: cpython/Lib/test/test_kqueue.py
imports: import errno
  import os
  import select
  import socket
  from test import support
  import time
  import unittest
label_desc: Use image node_id 4 for calling the TestKQueue obj's underlying member method code with example usage: obj.testPair() without return types