Skip to content

Use assertEqual instead of assertEquals for Python 3.11 compatibility. #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions test/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,28 @@ def test_ancient_date_mapped(self):
with self.conn.cursor() as cursor:
cursor.execute("dummy stmt")
result = cursor.fetchone()
self.assertEquals(result[0], "1899-12-31")
self.assertEqual(result[0], "1899-12-31")

def test_decimal_scale_zero(self):
self.conn.jconn.mockBigDecimalResult(12345, 0)
with self.conn.cursor() as cursor:
cursor.execute("dummy stmt")
result = cursor.fetchone()
self.assertEquals(str(result[0]), "12345")
self.assertEqual(str(result[0]), "12345")

def test_decimal_places(self):
self.conn.jconn.mockBigDecimalResult(12345, 1)
with self.conn.cursor() as cursor:
cursor.execute("dummy stmt")
result = cursor.fetchone()
self.assertEquals(str(result[0]), "1234.5")
self.assertEqual(str(result[0]), "1234.5")

def test_double_decimal(self):
self.conn.jconn.mockDoubleDecimalResult(1234.5)
with self.conn.cursor() as cursor:
cursor.execute("dummy stmt")
result = cursor.fetchone()
self.assertEquals(str(result[0]), "1234.5")
self.assertEqual(str(result[0]), "1234.5")

def test_sql_exception_on_execute(self):
self.conn.jconn.mockExceptionOnExecute("java.sql.SQLException", "expected")
Expand All @@ -85,7 +85,7 @@ def test_sql_exception_on_execute(self):
cursor.execute("dummy stmt")
self.fail("expected exception")
except jaydebeapi.DatabaseError as e:
self.assertEquals(str(e), "java.sql.SQLException: expected")
self.assertEqual(str(e), "java.sql.SQLException: expected")

def test_runtime_exception_on_execute(self):
self.conn.jconn.mockExceptionOnExecute("java.lang.RuntimeException", "expected")
Expand All @@ -94,39 +94,39 @@ def test_runtime_exception_on_execute(self):
cursor.execute("dummy stmt")
self.fail("expected exception")
except jaydebeapi.InterfaceError as e:
self.assertEquals(str(e), "java.lang.RuntimeException: expected")
self.assertEqual(str(e), "java.lang.RuntimeException: expected")

def test_sql_exception_on_commit(self):
self.conn.jconn.mockExceptionOnCommit("java.sql.SQLException", "expected")
try:
self.conn.commit()
self.fail("expected exception")
except jaydebeapi.DatabaseError as e:
self.assertEquals(str(e), "java.sql.SQLException: expected")
self.assertEqual(str(e), "java.sql.SQLException: expected")

def test_runtime_exception_on_commit(self):
self.conn.jconn.mockExceptionOnCommit("java.lang.RuntimeException", "expected")
try:
self.conn.commit()
self.fail("expected exception")
except jaydebeapi.InterfaceError as e:
self.assertEquals(str(e), "java.lang.RuntimeException: expected")
self.assertEqual(str(e), "java.lang.RuntimeException: expected")

def test_sql_exception_on_rollback(self):
self.conn.jconn.mockExceptionOnRollback("java.sql.SQLException", "expected")
try:
self.conn.rollback()
self.fail("expected exception")
except jaydebeapi.DatabaseError as e:
self.assertEquals(str(e), "java.sql.SQLException: expected")
self.assertEqual(str(e), "java.sql.SQLException: expected")

def test_runtime_exception_on_rollback(self):
self.conn.jconn.mockExceptionOnRollback("java.lang.RuntimeException", "expected")
try:
self.conn.rollback()
self.fail("expected exception")
except jaydebeapi.InterfaceError as e:
self.assertEquals(str(e), "java.lang.RuntimeException: expected")
self.assertEqual(str(e), "java.lang.RuntimeException: expected")

def test_cursor_with_statement(self):
self.conn.jconn.mockType("INTEGER")
Expand Down