Add tests for nextset
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from pymysql.tests.test_issues import *
|
||||
from pymysql.tests.test_basic import *
|
||||
from pymysql.tests.test_nextset import *
|
||||
from pymysql.tests.test_DictCursor import *
|
||||
from pymysql.tests.test_connection import TestConnection
|
||||
|
||||
|
||||
28
pymysql/tests/test_nextset.py
Normal file
28
pymysql/tests/test_nextset.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from pymysql.tests import base
|
||||
from pymysql import util
|
||||
|
||||
|
||||
class TestNextset(base.PyMySQLTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNextset, self).setUp()
|
||||
self.con = self.connections[0]
|
||||
|
||||
def test_nextset(self):
|
||||
cur = self.con.cursor()
|
||||
cur.execute("SELECT 1; SELECT 2;")
|
||||
self.assertEqual([(1,)], list(cur))
|
||||
|
||||
r = cur.nextset()
|
||||
self.assertTrue(r)
|
||||
|
||||
self.assertEqual([(2,)], list(cur))
|
||||
self.assertIsNone(cur.nextset())
|
||||
|
||||
def test_skip_nextset(self):
|
||||
cur = self.con.cursor()
|
||||
cur.execute("SELECT 1; SELECT 2;")
|
||||
self.assertEqual([(1,)], list(cur))
|
||||
|
||||
cur.execute("SELECT 42")
|
||||
self.assertEqual([(42,)], list(cur))
|
||||
Reference in New Issue
Block a user