Use assertEqual instead of deprecated assertEquals

This commit is contained in:
Ville Skyttä
2016-05-16 08:12:21 +03:00
parent 42c2b22f21
commit 6079889e51
4 changed files with 10 additions and 10 deletions

View File

@ -91,11 +91,11 @@ class DatabaseTest(unittest.TestCase):
# verify # verify
self.cursor.execute('select * from %s' % self.table) self.cursor.execute('select * from %s' % self.table)
l = self.cursor.fetchall() l = self.cursor.fetchall()
self.assertEquals(len(l), self.rows) self.assertEqual(len(l), self.rows)
try: try:
for i in range(self.rows): for i in range(self.rows):
for j in range(len(columndefs)): for j in range(len(columndefs)):
self.assertEquals(l[i][j], generator(i,j)) self.assertEqual(l[i][j], generator(i,j))
finally: finally:
if not self.debug: if not self.debug:
self.cursor.execute('drop table %s' % (self.table)) self.cursor.execute('drop table %s' % (self.table))
@ -116,10 +116,10 @@ class DatabaseTest(unittest.TestCase):
self.connection.commit() self.connection.commit()
self.cursor.execute('select * from %s' % self.table) self.cursor.execute('select * from %s' % self.table)
l = self.cursor.fetchall() l = self.cursor.fetchall()
self.assertEquals(len(l), self.rows) self.assertEqual(len(l), self.rows)
for i in range(self.rows): for i in range(self.rows):
for j in range(len(columndefs)): for j in range(len(columndefs)):
self.assertEquals(l[i][j], generator(i,j)) self.assertEqual(l[i][j], generator(i,j))
delete_statement = 'delete from %s where col1=%%s' % self.table delete_statement = 'delete from %s where col1=%%s' % self.table
self.cursor.execute(delete_statement, (0,)) self.cursor.execute(delete_statement, (0,))
self.cursor.execute('select col1 from %s where col1=%s' % \ self.cursor.execute('select col1 from %s where col1=%s' % \

View File

@ -56,8 +56,8 @@ class test_MySQLdb(capabilities.DatabaseTest):
c.callproc('test_sp', ('larch',)) c.callproc('test_sp', ('larch',))
rows = c.fetchall() rows = c.fetchall()
self.assertEquals(len(rows), 1) self.assertEqual(len(rows), 1)
self.assertEquals(rows[0][0], 3) self.assertEqual(rows[0][0], 3)
c.nextset() c.nextset()
c.execute("DROP PROCEDURE test_sp") c.execute("DROP PROCEDURE test_sp")

View File

@ -189,8 +189,8 @@ class test_MySQLdb(dbapi20.DatabaseAPI20Test):
s=cur.nextset() s=cur.nextset()
if s: if s:
empty = cur.fetchall() empty = cur.fetchall()
self.assertEquals(len(empty), 0, self.assertEqual(len(empty), 0,
"non-empty result set after other result sets") "non-empty result set after other result sets")
#warn("Incompatibility: MySQL returns an empty result set for the CALL itself", #warn("Incompatibility: MySQL returns an empty result set for the CALL itself",
# Warning) # Warning)
#assert s == None,'No more return sets, should return None' #assert s == None,'No more return sets, should return None'

View File

@ -67,8 +67,8 @@ class CoreAPI(unittest.TestCase):
"thread_id shouldn't accept arguments.") "thread_id shouldn't accept arguments.")
def test_affected_rows(self): def test_affected_rows(self):
self.assertEquals(self.conn.affected_rows(), 0, self.assertEqual(self.conn.affected_rows(), 0,
"Should return 0 before we do anything.") "Should return 0 before we do anything.")
#def test_debug(self): #def test_debug(self):