MCPcopy Index your code
hub / github.com/davispuh/MySQL-for-Python-3 / test_description

Method test_description

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

Source from the content-addressed store, hash-verified

266 con.close()
267
268 def test_description(self):
269 con = self._connect()
270 try:
271 cur = con.cursor()
272 self.executeDDL1(cur)
273 self.assertEqual(cur.description,None,
274 'cursor.description should be none after executing a '
275 'statement that can return no rows (such as DDL)'
276 )
277 cur.execute('select name from %sbooze' % self.table_prefix)
278 self.assertEqual(len(cur.description),1,
279 'cursor.description describes too many columns'
280 )
281 self.assertEqual(len(cur.description[0]),7,
282 'cursor.description[x] tuples must have 7 elements'
283 )
284 self.assertEqual(cur.description[0][0].lower(),'name',
285 'cursor.description[x][0] must return column name'
286 )
287 self.assertEqual(cur.description[0][1],self.driver.STRING,
288 'cursor.description[x][1] must return column type. Got %r'
289 % cur.description[0][1]
290 )
291
292 # Make sure self.description gets reset
293 self.executeDDL2(cur)
294 self.assertEqual(cur.description,None,
295 'cursor.description not being set to None when executing '
296 'no-result statements (eg. DDL)'
297 )
298 finally:
299 con.close()
300
301 def test_rowcount(self):
302 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