docstr: test #8710
docstr_tok: ["test","#","8710"]
code: def test_cursor_close_exception_raised_in_iteration(self):
      """test #8710"""
  
      User = self.classes.User
      s = fixture_session()
  
      stmt = select(User).execution_options(yield_per=1)
  
      result = s.execute(stmt)
      raw_cursor = result.raw
  
      for row in result:
          with expect_raises_message(Exception, "whoops"):
              for row in result:
                  raise Exception("whoops")
  
      is_true(raw_cursor._soft_closed)
  
imports: from sqlalchemy import delete
  from sqlalchemy import exc
  from sqlalchemy import insert
  from sqlalchemy import literal
  from sqlalchemy import literal_column
  from sqlalchemy import select
  from sqlalchemy import testing
  from sqlalchemy import text
  from sqlalchemy import update
  from sqlalchemy.orm import loading
  from sqlalchemy.orm import relationship
  from sqlalchemy.testing import is_true
  from sqlalchemy.testing import mock
  from sqlalchemy.testing.assertions import assert_raises
  from sqlalchemy.testing.assertions import assert_raises_message
  from sqlalchemy.testing.assertions import eq_
  from sqlalchemy.testing.assertions import expect_raises_message
  from sqlalchemy.testing.fixtures import fixture_session
  from .None import _fixtures
label_desc: Use image node_id 2 for calling the InstancesTest obj's underlying member method code with example usage: obj.test_cursor_close_exception_raised_in_iteration() without return types