MCPcopy
hub / github.com/psycopg/psycopg / test_description

Method test_description

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

Source from the content-addressed store, hash-verified

280 con.close()
281
282 def test_description(self):
283 con = self._connect()
284 try:
285 cur = con.cursor()
286 self.executeDDL1(cur)
287 self.assertEqual(cur.description,None,
288 'cursor.description should be none after executing a '
289 'statement that can return no rows (such as DDL)'
290 )
291 cur.execute('select name from %sbooze' % self.table_prefix)
292 self.assertEqual(len(cur.description),1,
293 'cursor.description describes too many columns'
294 )
295 self.assertEqual(len(cur.description[0]),7,
296 'cursor.description[x] tuples must have 7 elements'
297 )
298 self.assertEqual(cur.description[0][0].lower(),'name',
299 'cursor.description[x][0] must return column name'
300 )
301 self.assertEqual(cur.description[0][1],self.driver.STRING,
302 'cursor.description[x][1] must return column type. Got %r'
303 % cur.description[0][1]
304 )
305
306 # Make sure self.description gets reset
307 self.executeDDL2(cur)
308 self.assertEqual(cur.description,None,
309 'cursor.description not being set to None when executing '
310 'no-result statements (eg. DDL)'
311 )
312 finally:
313 con.close()
314
315 def test_rowcount(self):
316 con = self._connect()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected