Changeset: bfe35e0bf0f9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bfe35e0bf0f9
Modified Files:
python/test/dbapi20.py
python/test/runtests.py
Branch: default
Log Message:
fixed python3.1 compatability
diffs (297 lines):
diff -r 81a6eb449108 -r bfe35e0bf0f9 python/test/dbapi20.py
--- a/python/test/dbapi20.py Fri May 21 13:20:02 2010 +0200
+++ b/python/test/dbapi20.py Fri May 21 15:28:45 2010 +0200
@@ -190,7 +190,7 @@
# Must exist
threadsafety = self.driver.threadsafety
# Must be a valid value
- self.failUnless(threadsafety in (0,1,2,3))
+ self.assertTrue(threadsafety in (0,1,2,3))
except AttributeError:
self.fail("Driver doesn't define threadsafety")
@@ -199,7 +199,7 @@
# Must exist
paramstyle = self.driver.paramstyle
# Must be a valid value
- self.failUnless(paramstyle in (
+ self.assertTrue(paramstyle in (
'qmark','numeric','named','format','pyformat'
))
except AttributeError:
@@ -208,27 +208,27 @@
def test_Exceptions(self):
# Make sure required exceptions exist, and are in the
# defined heirarchy.
- self.failUnless(issubclass(self.driver.Warning,StandardError))
- self.failUnless(issubclass(self.driver.Error,StandardError))
- self.failUnless(
+ self.assertTrue(issubclass(self.driver.Warning,StandardError))
+ self.assertTrue(issubclass(self.driver.Error,StandardError))
+ self.assertTrue(
issubclass(self.driver.InterfaceError,self.driver.Error)
)
- self.failUnless(
+ self.assertTrue(
issubclass(self.driver.DatabaseError,self.driver.Error)
)
- self.failUnless(
+ self.assertTrue(
issubclass(self.driver.OperationalError,self.driver.Error)
)
- self.failUnless(
+ self.assertTrue(
issubclass(self.driver.IntegrityError,self.driver.Error)
)
- self.failUnless(
+ self.assertTrue(
issubclass(self.driver.InternalError,self.driver.Error)
)
- self.failUnless(
+ self.assertTrue(
issubclass(self.driver.ProgrammingError,self.driver.Error)
)
- self.failUnless(
+ self.assertTrue(
issubclass(self.driver.NotSupportedError,self.driver.Error)
)
@@ -241,15 +241,15 @@
# by default.
con = self._connect()
drv = self.driver
- self.failUnless(con.Warning is drv.Warning)
- self.failUnless(con.Error is drv.Error)
- self.failUnless(con.InterfaceError is drv.InterfaceError)
- self.failUnless(con.DatabaseError is drv.DatabaseError)
- self.failUnless(con.OperationalError is drv.OperationalError)
- self.failUnless(con.IntegrityError is drv.IntegrityError)
- self.failUnless(con.InternalError is drv.InternalError)
- self.failUnless(con.ProgrammingError is drv.ProgrammingError)
- self.failUnless(con.NotSupportedError is drv.NotSupportedError)
+ self.assertTrue(con.Warning is drv.Warning)
+ self.assertTrue(con.Error is drv.Error)
+ self.assertTrue(con.InterfaceError is drv.InterfaceError)
+ self.assertTrue(con.DatabaseError is drv.DatabaseError)
+ self.assertTrue(con.OperationalError is drv.OperationalError)
+ self.assertTrue(con.IntegrityError is drv.IntegrityError)
+ self.assertTrue(con.InternalError is drv.InternalError)
+ self.assertTrue(con.ProgrammingError is drv.ProgrammingError)
+ self.assertTrue(con.NotSupportedError is drv.NotSupportedError)
def test_commit(self):
@@ -341,12 +341,12 @@
cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
self.table_prefix
))
- self.failUnless(cur.rowcount in (-1,1),
+ self.assertTrue(cur.rowcount in (-1,1),
'cursor.rowcount should == number or rows inserted, or '
'set to -1 after executing an insert statement'
)
cur.execute("select name from %sbooze" % self.table_prefix)
- self.failUnless(cur.rowcount in (-1,1),
+ self.assertTrue(cur.rowcount in (-1,1),
'cursor.rowcount should == number of rows returned, or '
'set to -1 after executing a select statement'
)
@@ -409,7 +409,7 @@
cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
self.table_prefix
))
- self.failUnless(cur.rowcount in (-1,1))
+ self.assertTrue(cur.rowcount in (-1,1))
if self.driver.paramstyle == 'qmark':
cur.execute(
@@ -438,7 +438,7 @@
)
else:
self.fail('Invalid paramstyle')
- self.failUnless(cur.rowcount in (-1,1))
+ self.assertTrue(cur.rowcount in (-1,1))
cur.execute('select name from %sbooze' % self.table_prefix)
res = cur.fetchall()
@@ -490,7 +490,7 @@
)
else:
self.fail('Unknown paramstyle')
- self.failUnless(cur.rowcount in (-1,2),
+ self.assertTrue(cur.rowcount in (-1,2),
'insert using cursor.executemany set cursor.rowcount to '
'incorrect value %r' % cur.rowcount
)
@@ -525,7 +525,7 @@
'cursor.fetchone should return None if a query retrieves '
'no rows'
)
- self.failUnless(cur.rowcount in (-1,0))
+ self.assertTrue(cur.rowcount in (-1,0))
# cursor.fetchone should raise an Error if called after
# executing a query that cannnot return rows
@@ -545,7 +545,7 @@
self.assertEqual(cur.fetchone(),None,
'cursor.fetchone should return None if no more rows available'
)
- self.failUnless(cur.rowcount in (-1,1))
+ self.assertTrue(cur.rowcount in (-1,1))
finally:
con.close()
@@ -604,7 +604,7 @@
'cursor.fetchmany should return an empty sequence after '
'results are exhausted'
)
- self.failUnless(cur.rowcount in (-1,6))
+ self.assertTrue(cur.rowcount in (-1,6))
# Same as above, using cursor.arraysize
cur.arraysize=4
@@ -617,12 +617,12 @@
self.assertEqual(len(r),2)
r = cur.fetchmany() # Should be an empty sequence
self.assertEqual(len(r),0)
- self.failUnless(cur.rowcount in (-1,6))
+ self.assertTrue(cur.rowcount in (-1,6))
cur.arraysize=6
cur.execute('select name from %sbooze' % self.table_prefix)
rows = cur.fetchmany() # Should get all rows
- self.failUnless(cur.rowcount in (-1,6))
+ self.assertTrue(cur.rowcount in (-1,6))
self.assertEqual(len(rows),6)
self.assertEqual(len(rows),6)
rows = [r[0] for r in rows]
@@ -639,7 +639,7 @@
'cursor.fetchmany should return an empty sequence if '
'called after the whole result set has been fetched'
)
- self.failUnless(cur.rowcount in (-1,6))
+ self.assertTrue(cur.rowcount in (-1,6))
self.executeDDL2(cur)
cur.execute('select name from %sbarflys' % self.table_prefix)
@@ -648,7 +648,7 @@
'cursor.fetchmany should return an empty sequence if '
'query retrieved no rows'
)
- self.failUnless(cur.rowcount in (-1,0))
+ self.assertTrue(cur.rowcount in (-1,0))
finally:
con.close()
@@ -672,7 +672,7 @@
cur.execute('select name from %sbooze' % self.table_prefix)
rows = cur.fetchall()
- self.failUnless(cur.rowcount in (-1,len(self.samples)))
+ self.assertTrue(cur.rowcount in (-1,len(self.samples)))
self.assertEqual(len(rows),len(self.samples),
'cursor.fetchall did not retrieve all rows'
)
@@ -688,12 +688,12 @@
'cursor.fetchall should return an empty list if called '
'after the whole result set has been fetched'
)
- self.failUnless(cur.rowcount in (-1,len(self.samples)))
+ self.assertTrue(cur.rowcount in (-1,len(self.samples)))
self.executeDDL2(cur)
cur.execute('select name from %sbarflys' % self.table_prefix)
rows = cur.fetchall()
- self.failUnless(cur.rowcount in (-1,0))
+ self.assertTrue(cur.rowcount in (-1,0))
self.assertEqual(len(rows),0,
'cursor.fetchall should return an empty list if '
'a select query returns no rows'
@@ -715,7 +715,7 @@
rows23 = cur.fetchmany(2)
rows4 = cur.fetchone()
rows56 = cur.fetchall()
- self.failUnless(cur.rowcount in (-1,6))
+ self.assertTrue(cur.rowcount in (-1,6))
self.assertEqual(len(rows23),2,
'fetchmany returned incorrect number of rows'
)
@@ -792,7 +792,7 @@
con = self._connect()
try:
cur = con.cursor()
- self.failUnless(hasattr(cur,'arraysize'),
+ self.assertTrue(hasattr(cur,'arraysize'),
'cursor.arraysize must be defined'
)
finally:
@@ -861,27 +861,27 @@
b = self.driver.Binary('')
def test_STRING(self):
- self.failUnless(hasattr(self.driver,'STRING'),
+ self.assertTrue(hasattr(self.driver,'STRING'),
'module.STRING must be defined'
)
def test_BINARY(self):
- self.failUnless(hasattr(self.driver,'BINARY'),
+ self.assertTrue(hasattr(self.driver,'BINARY'),
'module.BINARY must be defined.'
)
def test_NUMBER(self):
- self.failUnless(hasattr(self.driver,'NUMBER'),
+ self.assertTrue(hasattr(self.driver,'NUMBER'),
'module.NUMBER must be defined.'
)
def test_DATETIME(self):
- self.failUnless(hasattr(self.driver,'DATETIME'),
+ self.assertTrue(hasattr(self.driver,'DATETIME'),
'module.DATETIME must be defined.'
)
def test_ROWID(self):
- self.failUnless(hasattr(self.driver,'ROWID'),
+ self.assertTrue(hasattr(self.driver,'ROWID'),
'module.ROWID must be defined.'
)
diff -r 81a6eb449108 -r bfe35e0bf0f9 python/test/runtests.py
--- a/python/test/runtests.py Fri May 21 13:20:02 2010 +0200
+++ b/python/test/runtests.py Fri May 21 15:28:45 2010 +0200
@@ -32,7 +32,7 @@
try:
import monetdb.sql
except ImportError:
- print "monetdb python API not found, using local monetdb python API"
+ print("monetdb python API not found, using local monetdb python API")
import sys
parent = os.path.join(sys.path[0], '..')
sys.path.append(parent)
@@ -231,15 +231,15 @@
def test_Exceptions(self):
# we override this since StandardError is depricated in python 3
- self.failUnless(issubclass(self.driver.Warning,Exception))
- self.failUnless(issubclass(self.driver.Error,Exception))
- self.failUnless(issubclass(self.driver.InterfaceError,
self.driver.Error))
- self.failUnless(issubclass(self.driver.DatabaseError,
self.driver.Error))
- self.failUnless(issubclass(self.driver.OperationalError,
self.driver.Error))
- self.failUnless(issubclass(self.driver.IntegrityError,
self.driver.Error))
- self.failUnless(issubclass(self.driver.InternalError,
self.driver.Error))
- self.failUnless(issubclass(self.driver.ProgrammingError,
self.driver.Error))
- self.failUnless(issubclass(self.driver.NotSupportedError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.Warning,Exception))
+ self.assertTrue(issubclass(self.driver.Error,Exception))
+ self.assertTrue(issubclass(self.driver.InterfaceError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.DatabaseError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.OperationalError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.IntegrityError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.InternalError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.ProgrammingError,
self.driver.Error))
+ self.assertTrue(issubclass(self.driver.NotSupportedError,
self.driver.Error))
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list