From 89ed246739d4243328fd3fc3c292e62dfe4bdcc8 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 7 Jul 2011 21:44:03 -0700 Subject: [PATCH] Added some tests for cursor.description --- tests/test_cursor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_cursor.py b/tests/test_cursor.py index 31f509f..0f1977d 100644 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -164,6 +164,16 @@ def test_integrity_error(self, connection): with py.test.raises(connection.IntegrityError): cursor.execute("INSERT INTO people (uid) VALUES (1)") + def test_description(self, connection): + with self.create_table(connection, "people", uid="INT"): + with contextlib.closing(connection.cursor()) as cursor: + cursor.execute("DELETE FROM people WHERE uid = %s", (1,)) + assert cursor.description is None + + cursor.execute("SELECT uid FROM people") + assert len(cursor.description) == 1 + assert cursor.description[0][0] == "uid" + class TestDictCursor(BaseMySQLTests): def test_fetchall(self, connection): with self.create_table(connection, "people", name="VARCHAR(20)", age="INT"):