class_docstr: Test a database self.driver for DB API 2.0 compatibility.
  This implementation tests Gadfly, but the TestCase
  is structured so that other self.drivers can subclass this
  test case to ensure compliance with the DB-API. It is
  expected that this TestCase may be expanded in the future
  if ambiguities or edge conditions are discovered.
  
  The 'Optional Extensions' are not yet being tested.
  
  self.drivers should subclass this test, overriding setUp, tearDown,
  self.driver, connect_args and connect_kw_args. Class specification
  should be as follows:
  
  from . import dbapi20
  class mytest(dbapi20.DatabaseAPI20Test):
     [...]
  
  Don't 'from .dbapi20 import DatabaseAPI20Test', or you will
  confuse the unit tester - just 'from . import dbapi20'.
class_docstr_tok: ["Test","a","database","self.driver","for","DB","API","2.0","compatibility",".","This","implementation","tests","Gadfly",",","but","the","TestCase","is","structured","so","that","other","self.drivers","can","subclass","this","test","case","to","ensure","compliance","with","the","DB-API",".","It","is","expected","that","this","TestCase","may","be","expanded","in","the","future","if","ambiguities","or","edge","conditions","are","discovered",".","The","'Optional","Extensions","'","are","not","yet","being","tested",".","self.drivers","should","subclass","this","test",",","overriding","setUp",",","tearDown",",","self.driver",",","connect_args","and","connect_kw_args",".","Class","specification","should","be","as","follows",":","from",".","import","dbapi20","class","mytest","(","dbapi20.DatabaseAPI20Test",")",":","[","...","]","Do","n't","'from",".dbapi20","import","DatabaseAPI20Test","'",",","or","you","will","confuse","the","unit","tester","-","just","'from",".","import","dbapi20","'","."]
code: def test_fetchone(self):
      con = self._connect()
      try:
          cur = con.cursor()
  
          # cursor.fetchone should raise an Error if called before
          # executing a select-type query
          self.assertRaises(self.driver.Error, cur.fetchone)
  
          # cursor.fetchone should raise an Error if called after
          # executing a query that cannot return rows
          self.executeDDL1(cur)
          self.assertRaises(self.driver.Error, cur.fetchone)
  
          cur.execute("select name from %sbooze" % self.table_prefix)
          self.assertEqual(
              cur.fetchone(),
              None,
              "cursor.fetchone should return None if a query retrieves "
              "no rows",
          )
          self.failUnless(cur.rowcount in (-1, 0))
  
          # cursor.fetchone should raise an Error if called after
          # executing a query that cannot return rows
          cur.execute(
              "insert into %sbooze values ('Victoria Bitter')"
              % (self.table_prefix)
          )
          self.assertRaises(self.driver.Error, cur.fetchone)
  
          cur.execute("select name from %sbooze" % self.table_prefix)
          r = cur.fetchone()
          self.assertEqual(
              len(r),
              1,
              "cursor.fetchone should have retrieved a single row",
          )
          self.assertEqual(
              r[0],
              "Victoria Bitter",
              "cursor.fetchone retrieved incorrect data",
          )
          self.assertEqual(
              cur.fetchone(),
              None,
              "cursor.fetchone should return None if no more rows available",
          )
          self.failUnless(cur.rowcount in (-1, 1))
      finally:
          con.close()
  
imports: import unittest
  import time
  import sys
label_desc: Use image node_id 23 for calling the DatabaseAPI20Test obj's underlying member method code with example usage: obj.test_fetchone() without return types