<s> from pymysql . tests import base <EOL> from pymysql import util <EOL> try : <EOL> import unittest2 as unittest <EOL> except ImportError : <EOL> import unittest <EOL> class TestNextset ( base . PyMySQLTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestNextset , self ) . setUp ( ) <EOL> self . con = self . connections [ <NUM_LIT:0> ] <EOL> def test_nextset ( self ) : <EOL> cur = self . con . cursor ( ) <EOL> cur . execute ( "<STR_LIT>" ) <EOL> self . assertEqual ( [ ( <NUM_LIT:1> , ) ] , list ( cur ) ) <EOL> r = cur . nextset ( ) <EOL> self . assertTrue ( r ) <EOL> self . assertEqual ( [ ( <NUM_LIT:2> , ) ] , list ( cur ) ) <EOL> self . assertIsNone ( cur . nextset ( ) ) <EOL> def test_skip_nextset ( self ) : <EOL> cur = self . con . cursor ( ) <EOL> cur . execute ( "<STR_LIT>" ) <EOL> self . assertEqual ( [ ( <NUM_LIT:1> , ) ] , list ( cur ) ) <EOL> cur . execute ( "<STR_LIT>" ) <EOL> self . assertEqual ( [ ( <NUM_LIT> , ) ] , list ( cur ) ) <EOL> def test_ok_and_next ( self ) : <EOL> cur = self . con . cursor ( ) <EOL> cur . execute ( "<STR_LIT>" ) <EOL> self . assertEqual ( [ ( <NUM_LIT:1> , ) ] , list ( cur ) ) <EOL> self . assertTrue ( cur . nextset ( ) ) <EOL> self . assertTrue ( cur . nextset ( ) ) <EOL> self . assertEqual ( [ ( <NUM_LIT:2> , ) ] , list ( cur ) ) <EOL> self . assertFalse ( bool ( cur . nextset ( ) ) ) <EOL> @ unittest . expectedFailure <EOL> def test_multi_cursor ( self ) : <EOL> cur1 = self . con . cursor ( ) <EOL> cur2 = self . con . cursor ( ) <EOL> cur1 . execute ( "<STR_LIT>" ) <EOL> cur2 . execute ( "<STR_LIT>" ) <EOL> self . assertEqual ( [ ( <NUM_LIT:1> , ) ] , list ( cur1 ) ) <EOL> self . assertEqual ( [ ( <NUM_LIT> , ) ] , list ( cur2 ) ) <EOL> r = cur1 . nextset ( ) <EOL> self . assertTrue ( r ) <EOL> self . assertEqual ( [ ( <NUM_LIT:2> , ) ] , list ( cur1 ) ) <EOL> self . assertIsNone ( cur1 . nextset ( ) ) </s>
