code: def test_async_iter(self):
      cur = self.conn.cursor()
  
      cur.execute("begin")
      self.wait(cur)
      cur.execute(
          """
              insert into table1 values (1);
              insert into table1 values (2);
              insert into table1 values (3);
          """
      )
      self.wait(cur)
      cur.execute("select id from table1 order by id")
  
      # iteration fails if a query is underway
      self.assertRaises(psycopg2.ProgrammingError, list, cur)
  
      # but after it's done it should work
      self.wait(cur)
      self.assertEquals(list(cur), [(1,), (2,), (3,)])
      self.assertFalse(self.conn.isexecuting())
  
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 12 for calling the AsyncTests obj's underlying member method code with example usage: obj.test_async_iter() without return types