MCPcopy
hub / github.com/psycopg/psycopg / test_mixedfetch

Method test_mixedfetch

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

Source from the content-addressed store, hash-verified

685 con.close()
686
687 def test_mixedfetch(self):
688 con = self._connect()
689 try:
690 cur = con.cursor()
691 self.executeDDL1(cur)
692 for sql in self._populate():
693 cur.execute(sql)
694
695 cur.execute('select name from %sbooze' % self.table_prefix)
696 rows1 = cur.fetchone()
697 rows23 = cur.fetchmany(2)
698 rows4 = cur.fetchone()
699 rows56 = cur.fetchall()
700 self.assertTrue(cur.rowcount in (-1,6))
701 self.assertEqual(len(rows23),2,
702 'fetchmany returned incorrect number of rows'
703 )
704 self.assertEqual(len(rows56),2,
705 'fetchall returned incorrect number of rows'
706 )
707
708 rows = [rows1[0]]
709 rows.extend([rows23[0][0],rows23[1][0]])
710 rows.append(rows4[0])
711 rows.extend([rows56[0][0],rows56[1][0]])
712 rows.sort()
713 for i in range(0,len(self.samples)):
714 self.assertEqual(rows[i],self.samples[i],
715 'incorrect data retrieved or inserted'
716 )
717 finally:
718 con.close()
719
720 def help_nextset_setUp(self,cur):
721 ''' Should create a procedure called deleteme

Callers

nothing calls this directly

Calls 9

_connectMethod · 0.95
executeDDL1Method · 0.95
_populateMethod · 0.95
cursorMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45
fetchmanyMethod · 0.45
fetchallMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected