Skip to content

Commit

Permalink
add test_extract_error_message (#12548)
Browse files Browse the repository at this point in the history
  • Loading branch information
kstrz authored Jan 15, 2021
1 parent e6a76a5 commit 5fbfb82
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/db_engine_specs/mysql_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,15 @@ def test_is_db_column_type_match(self):
assert MySQLEngineSpec.is_db_column_type_match(
type_str, DbColumnType.TEMPORAL
) is (col_type == DbColumnType.TEMPORAL)

def test_extract_error_message(self):
from MySQLdb._exceptions import OperationalError

message = "Unknown table 'BIRTH_NAMES1' in information_schema"
exception = OperationalError(message)
extracted_message = MySQLEngineSpec._extract_error_message(exception)
assert extracted_message == message

exception = OperationalError(123, message)
extracted_message = MySQLEngineSpec._extract_error_message(exception)
assert extracted_message == message

0 comments on commit 5fbfb82

Please sign in to comment.