code: def test_flush_on_write(self):
      # a very large query requires a flush loop to be sent to the backend
      curs = self.conn.cursor()
      for mb in 1, 5, 10, 20, 50:
          size = mb * 1024 * 1024
          stub = PollableStub(self.conn)
          curs.execute("select %s;", ("x" * size,))
          self.wait(stub)
          self.assertEqual(size, len(curs.fetchone()[0]))
          if stub.polls.count(ext.POLL_WRITE) > 1:
              return
  
      # This is more a testing glitch than an error: it happens
      # on high load on linux: probably because the kernel has more
      # buffers ready. A warning may be useful during development,
      # but an error is bad during regression testing.
      warnings.warn(
          "sending a large query didn't trigger block on write."
      )
  
imports: import gc
  import time
  import unittest
  import warnings
  import psycopg2
  import psycopg2.errors
  from psycopg2 import extensions
  from .testutils import ConnectingTestCase, StringIO, skip_before_postgres, skip_if_crdb, crdb_version, slow
label_desc: Use image node_id 20 for calling the AsyncTests obj's underlying member method code with example usage: obj.test_flush_on_write() without return types