Skip to content

Commit

Permalink
Add test for iterator interface
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed May 23, 2023
1 parent b833e04 commit f844562
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pymysql/tests/test_cursor.py
Expand Up @@ -25,6 +25,14 @@ def setUp(self):
self.test_connection = pymysql.connect(**self.databases[0])
self.addCleanup(self.test_connection.close)

def test_cursor_is_iterator(self):
"""Test that the cursor is an iterator"""
conn = self.test_connection
cursor = conn.cursor()
cursor.execute("select * from test")
self.assertEqual(cursor.__iter__(), cursor)
self.assertEqual(cursor.__next__(), ("row1",))

def test_cleanup_rows_unbuffered(self):
conn = self.test_connection
cursor = conn.cursor(pymysql.cursors.SSCursor)
Expand Down

0 comments on commit f844562

Please sign in to comment.