<s> import sys <EOL> try : <EOL> from pymysql . tests import base <EOL> import pymysql . cursors <EOL> except Exception : <EOL> sys . path . append ( '<STR_LIT>' ) <EOL> from pymysql . tests import base <EOL> import pymysql . cursors <EOL> class TestSSCursor ( base . PyMySQLTestCase ) : <EOL> def test_SSCursor ( self ) : <EOL> affected_rows = <NUM_LIT> <EOL> conn = self . connections [ <NUM_LIT:0> ] <EOL> data = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , ] <EOL> try : <EOL> cursor = conn . cursor ( pymysql . cursors . SSCursor ) <EOL> cursor . execute ( ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> for i in data : <EOL> cursor . execute ( '<STR_LIT>' , i ) <EOL> self . assertEqual ( conn . affected_rows ( ) , <NUM_LIT:1> , '<STR_LIT>' ) <EOL> conn . commit ( ) <EOL> iter = <NUM_LIT:0> <EOL> cursor . execute ( '<STR_LIT>' ) <EOL> while True : <EOL> row = cursor . fetchone ( ) <EOL> if row is None : <EOL> break <EOL> iter += <NUM_LIT:1> <EOL> self . assertEqual ( cursor . rowcount , affected_rows , <EOL> '<STR_LIT>' % ( str ( affected_rows ) ) ) <EOL> self . assertEqual ( cursor . rownumber , iter , <EOL> '<STR_LIT>' % ( str ( iter ) ) ) <EOL> self . assertEqual ( ( row in data ) , True , <EOL> '<STR_LIT>' ) <EOL> cursor . execute ( '<STR_LIT>' ) <EOL> self . assertEqual ( len ( cursor . fetchall ( ) ) , len ( data ) , <EOL> '<STR_LIT>' ) <EOL> cursor . execute ( '<STR_LIT>' ) <EOL> self . assertEqual ( len ( cursor . fetchmany ( <NUM_LIT:2> ) ) , <NUM_LIT:2> , <EOL> '<STR_LIT>' ) <EOL> while True : <EOL> res = cursor . fetchone ( ) <EOL> if res is None : <EOL> break <EOL> cursor . execute ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> conn . commit ( ) <EOL> self . assertEqual ( cursor . rowcount , len ( data ) , <EOL> '<STR_LIT>' % ( str ( len ( data ) ) ) ) <EOL> cursor . executemany ( '<STR_LIT>' , data ) <EOL> self . assertEqual ( cursor . rowcount , len ( data ) , <EOL> '<STR_LIT>' % ( str ( len ( data ) ) ) ) <EOL> finally : <EOL> cursor . execute ( '<STR_LIT>' ) <EOL> cursor . close ( ) <EOL> __all__ = [ "<STR_LIT>" ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import unittest <EOL> unittest . main ( ) </s>
