code: def test_non_block_after_notification(self):
      from select import select
  
      cur = self.conn.cursor()
      cur.execute(
          """
              select 1;
              do $$
                  begin
                      raise notice 'hello';
                  end
              $$ language plpgsql;
              select pg_sleep(1);
              """
      )
  
      polls = 0
      while True:
          state = self.conn.poll()
          if state == psycopg2.extensions.POLL_OK:
              break
          elif state == psycopg2.extensions.POLL_READ:
              select([self.conn], [], [], 0.1)
          elif state == psycopg2.extensions.POLL_WRITE:
              select([], [self.conn], [], 0.1)
          else:
              raise Exception("Unexpected result from poll: %r", state)
          polls += 1
  
      self.assert_(polls >= 8, polls)
  
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 31 for calling the AsyncTests obj's underlying member method code with example usage: obj.test_non_block_after_notification() without return types