MCPcopy
hub / github.com/psycopg/psycopg / test_rowcount

Method test_rowcount

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

Source from the content-addressed store, hash-verified

313 con.close()
314
315 def test_rowcount(self):
316 con = self._connect()
317 try:
318 cur = con.cursor()
319 self.executeDDL1(cur)
320 self.assertEqual(cur.rowcount,-1,
321 'cursor.rowcount should be -1 after executing no-result '
322 'statements'
323 )
324 cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
325 self.table_prefix
326 ))
327 self.assertTrue(cur.rowcount in (-1,1),
328 'cursor.rowcount should == number or rows inserted, or '
329 'set to -1 after executing an insert statement'
330 )
331 cur.execute("select name from %sbooze" % self.table_prefix)
332 self.assertTrue(cur.rowcount in (-1,1),
333 'cursor.rowcount should == number of rows returned, or '
334 'set to -1 after executing a select statement'
335 )
336 self.executeDDL2(cur)
337 self.assertEqual(cur.rowcount,-1,
338 'cursor.rowcount not being reset to -1 after executing '
339 'no-result statements'
340 )
341 finally:
342 con.close()
343
344 lower_func = 'lower'
345 def test_callproc(self):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected