MCPcopy Index your code
hub / github.com/PyMySQL/mysqlclient / test_description

Method test_description

tests/dbapi20.py:252–293  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

250 con.close()
251
252 def test_description(self):
253 con = self._connect()
254 try:
255 cur = con.cursor()
256 self.executeDDL1(cur)
257 self.assertEqual(
258 cur.description,
259 None,
260 "cursor.description should be none after executing a "
261 "statement that can return no rows (such as DDL)",
262 )
263 cur.execute("select name from %sbooze" % self.table_prefix)
264 self.assertEqual(
265 len(cur.description), 1, "cursor.description describes too many columns"
266 )
267 self.assertEqual(
268 len(cur.description[0]),
269 7,
270 "cursor.description[x] tuples must have 7 elements",
271 )
272 self.assertEqual(
273 cur.description[0][0].lower(),
274 "name",
275 "cursor.description[x][0] must return column name",
276 )
277 self.assertEqual(
278 cur.description[0][1],
279 self.driver.STRING,
280 "cursor.description[x][1] must return column type. Got %r"
281 % cur.description[0][1],
282 )
283
284 # Make sure self.description gets reset
285 self.executeDDL2(cur)
286 self.assertEqual(
287 cur.description,
288 None,
289 "cursor.description not being set to None when executing "
290 "no-result statements (eg. DDL)",
291 )
292 finally:
293 con.close()
294
295 def test_rowcount(self):
296 con = self._connect()

Callers

nothing calls this directly

Calls 6

_connectMethod · 0.95
executeDDL1Method · 0.95
executeDDL2Method · 0.95
cursorMethod · 0.80
executeMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected