Skip to content

Commit

Permalink
chore(tests): Spelling (apache#25454)
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Soref <[email protected]>
Co-authored-by: Evan Rusackas <[email protected]>
Co-authored-by: John Bodley <[email protected]>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent 175ba78 commit 1818054
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _create_user(username: str, role: str = "Admin", password: str = "general"):
username,
"firstname",
"lastname",
"email@exaple.com",
"email@example.com",
security_manager.find_role(role),
password,
)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration_tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2185,17 +2185,17 @@ def test_test_connection_failed_invalid_hostname(
"""
Database API: Test test connection failed due to invalid hostname
"""
msg = 'psql: error: could not translate host name "locahost" to address: nodename nor servname provided, or not known'
msg = 'psql: error: could not translate host name "localhost_" to address: nodename nor servname provided, or not known'
mock_build_db.return_value.set_sqlalchemy_uri.side_effect = DBAPIError(
msg, None, None
)
mock_build_db.return_value.db_engine_spec.__name__ = "Some name"
superset_error = SupersetError(
message='Unable to resolve hostname "locahost".',
message='Unable to resolve hostname "localhost_".',
error_type="CONNECTION_INVALID_HOSTNAME_ERROR",
level="error",
extra={
"hostname": "locahost",
"hostname": "localhost_",
"issue_codes": [
{
"code": 1007,
Expand All @@ -2212,7 +2212,7 @@ def test_test_connection_failed_invalid_hostname(

self.login(ADMIN_USERNAME)
data = {
"sqlalchemy_uri": "postgres://username:password@locahost:12345/db",
"sqlalchemy_uri": "postgres://username:password@localhost_:12345/db",
"database_name": "examples",
"impersonate_user": False,
"server_cert": None,
Expand Down Expand Up @@ -3840,7 +3840,7 @@ def test_validate_sql_errors(self):
Database API: validate SQL with errors
"""
request_payload = {
"sql": "SELECT col1 froma table1",
"sql": "SELECT col1 from_ table1",
"schema": None,
"template_params": None,
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/db_engine_specs/bigquery_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ def test_extract_errors(self):
)
]

msg = 'Syntax error: Expected end of input but got identifier "fromm"'
msg = 'Syntax error: Expected end of input but got identifier "from_"'
result = BigQueryEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
message='Please check your query for syntax errors at or near "fromm". Then, try running your query again.',
message='Please check your query for syntax errors at or near "from_". Then, try running your query again.',
error_type=SupersetErrorType.SYNTAX_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/db_engine_specs/gsheets_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def test_extract_errors(self):
"""
Test that custom error messages are extracted correctly.
"""
msg = 'SQLError: near "fromm": syntax error'
msg = 'SQLError: near "from_": syntax error'
result = GSheetsEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
message='Please check your query for syntax errors near "fromm". Then, try running your query again.',
message='Please check your query for syntax errors near "from_". Then, try running your query again.',
error_type=SupersetErrorType.SYNTAX_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/db_engine_specs/mysql_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ def test_extract_errors(self):
)
]

msg = "check the manual that corresponds to your MySQL server version for the right syntax to use near 'fromm"
msg = "check the manual that corresponds to your MySQL server version for the right syntax to use near 'from_"
result = MySQLEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
message='Please check your query for syntax errors near "fromm". Then, try running your query again.',
message='Please check your query for syntax errors near "from_". Then, try running your query again.',
error_type=SupersetErrorType.SYNTAX_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand Down
10 changes: 5 additions & 5 deletions tests/integration_tests/db_engine_specs/postgres_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_time_exp_lowr_col_sec_1y(self):
"(timestamp 'epoch' + lower_case * interval '1 second'))",
)

def test_time_exp_mixd_case_col_1y(self):
def test_time_exp_mixed_case_col_1y(self):
"""
DB Eng Specs (postgres): Test grain expr mixed case 1 YEAR
"""
Expand Down Expand Up @@ -241,14 +241,14 @@ def test_extract_errors(self):
]

msg = (
'psql: error: could not translate host name "locahost" to address: '
'psql: error: could not translate host name "localhost_" to address: '
"nodename nor servname provided, or not known"
)
result = PostgresEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_INVALID_HOSTNAME_ERROR,
message='The hostname "locahost" cannot be resolved.',
message='The hostname "localhost_" cannot be resolved.',
level=ErrorLevel.ERROR,
extra={
"engine_name": "PostgreSQL",
Expand Down Expand Up @@ -421,11 +421,11 @@ def test_extract_errors(self):
)
]

msg = 'syntax error at or near "fromm"'
msg = 'syntax error at or near "from_"'
result = PostgresEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
message='Please check your query for syntax errors at or near "fromm". Then, try running your query again.',
message='Please check your query for syntax errors at or near "from_". Then, try running your query again.',
error_type=SupersetErrorType.SYNTAX_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/db_engine_specs/presto_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def test_extract_error_message_orig(self):
result = PrestoEngineSpec._extract_error_message(exception)
assert result == "name at location: msg"

def test_extract_error_message_db_errr(self):
def test_extract_error_message_db_error(self):
from pyhive.exc import DatabaseError

exception = DatabaseError({"message": "Err message"})
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/event_logger_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_config_class_deprecation(self):
# class is instantiated and returned
self.assertIsInstance(res, DBEventLogger)

def test_raises_typerror_if_not_abc(self):
def test_raises_typeerror_if_not_abc(self):
# test that assignment of non AbstractEventLogger derived type raises
# TypeError
with self.assertRaises(TypeError):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/sql_lab/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TestSqlLabApi(SupersetTestCase):
{"SQLLAB_BACKEND_PERSISTENCE": False},
clear=True,
)
def test_get_from_empty_bootsrap_data(self):
def test_get_from_empty_bootstrap_data(self):
if utils.backend() == "postgresql":
# failing
return
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/db_engine_specs/test_athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def test_extract_errors() -> None:

from superset.db_engine_specs.athena import AthenaEngineSpec

msg = ": mismatched input 'fromm'. Expecting: "
msg = ": mismatched input 'from_'. Expecting: "
result = AthenaEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
message='Please check your query for syntax errors at or near "fromm". Then, try running your query again.',
message='Please check your query for syntax errors at or near "from_". Then, try running your query again.',
error_type=SupersetErrorType.SYNTAX_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/db_engine_specs/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ def test_extract_errors() -> None:
Test that custom error messages are extracted correctly.
"""

msg = ": mismatched input 'fromm'. Expecting: "
msg = ": mismatched input 'from_'. Expecting: "
result = DatabricksNativeEngineSpec.extract_errors(Exception(msg))

assert result == [
SupersetError(
message=": mismatched input 'fromm'. Expecting: ",
message=": mismatched input 'from_'. Expecting: ",
error_type=SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand All @@ -204,13 +204,13 @@ def test_extract_errors_with_context() -> None:
Test that custom error messages are extracted correctly with context.
"""

msg = ": mismatched input 'fromm'. Expecting: "
msg = ": mismatched input 'from_'. Expecting: "
context = {"hostname": "foo"}
result = DatabricksNativeEngineSpec.extract_errors(Exception(msg), context)

assert result == [
SupersetError(
message=": mismatched input 'fromm'. Expecting: ",
message=": mismatched input 'from_'. Expecting: ",
error_type=SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
level=ErrorLevel.ERROR,
extra={
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/db_engine_specs/test_mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_where_clause_n_prefix() -> None:
assert query == query_expected


def test_time_exp_mixd_case_col_1y() -> None:
def test_time_exp_mixed_case_col_1y() -> None:
from superset.db_engine_specs.mssql import MssqlEngineSpec

col = column("MixedCase")
Expand Down Expand Up @@ -291,14 +291,14 @@ def test_extract_errors() -> None:
msg = dedent(
"""
DB-Lib error message 20009, severity 9:
Unable to connect: Adaptive Server is unavailable or does not exist (locahost)
Unable to connect: Adaptive Server is unavailable or does not exist (localhost_)
"""
)
result = MssqlEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
error_type=SupersetErrorType.CONNECTION_INVALID_HOSTNAME_ERROR,
message='The hostname "locahost" cannot be resolved.',
message='The hostname "localhost_" cannot be resolved.',
level=ErrorLevel.ERROR,
extra={
"engine_name": "Microsoft SQL Server",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/pandas_postprocessing/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_pivot_fill_values():

def test_pivot_fill_column_values():
"""
Make sure pivot witn null column names returns correct DataFrame
Make sure pivot with null column names returns correct DataFrame
"""
df_copy = categories_df.copy()
df_copy["category"] = None
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/pandas_postprocessing/test_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_should_raise_exception_duplication():
)


def test_should_raise_exception_duplication_on_multiindx():
def test_should_raise_exception_duplication_on_multiindex():
iterables = [["m1", "m2"], ["a", "b"], ["x", "y"]]
columns = pd.MultiIndex.from_product(iterables, names=[None, "level1", "level2"])
df = pd.DataFrame(index=[0, 1, 2], columns=columns, data=1)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/sql_parse_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ def get_rls_for_table(
"id=42",
"SELECT * FROM other_table WHERE 1=1",
),
# If there's no pre-existing WHERE clause we create one.
# If there's no preexisting WHERE clause we create one.
(
"SELECT * FROM table",
"table",
Expand Down

0 comments on commit 1818054

Please sign in to comment.