def test_close(self, mock_session, mock_executor): mock_session.return_value = None read_ahead_cursor = ReadAheadCursor(MOCK_STATEMENT_RESULT, mock_session, MOCK_TRANSACTION_ID, MOCK_READ_AHEAD, mock_executor) read_ahead_cursor.close() self.assertFalse(read_ahead_cursor._is_open)
def test_next_when_closed(self, mock_session, mock_executor): read_ahead_cursor = ReadAheadCursor(MOCK_STATEMENT_RESULT, mock_session, MOCK_TRANSACTION_ID, MOCK_READ_AHEAD, mock_executor) read_ahead_cursor.close() self.assertRaises(ResultClosedError, next, read_ahead_cursor)