Skip to content

Commit

Permalink
commit changes to get black to work in precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
David McNulla committed Feb 1, 2022
1 parent 3f3b55f commit 3216e6a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
4 changes: 3 additions & 1 deletion superset/db_engine_specs/teradata.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def _get_table(tlist: TokenList) -> Optional[Table]:
tokens = tlist.tokens[:idx]

odd_token_number = len(tokens) in (1, 3, 5)
qualified_name_parts = all(imt(token, t=[Name, String]) for token in tokens[::2])
qualified_name_parts = all(
imt(token, t=[Name, String]) for token in tokens[::2]
)
dot_separators = all(imt(token, m=(Punctuation, ".")) for token in tokens[1::2])
if odd_token_number and qualified_name_parts and dot_separators:
return Table(*[remove_quotes(token.value) for token in tokens[::-2]])
Expand Down
36 changes: 20 additions & 16 deletions tests/unit_tests/db_engine_specs/test_teradata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
# specific language governing permissions and limitations
# under the License.
# pylint: disable=unused-argument, import-outside-toplevel, protected-access
from datetime import datetime

import pytest
from flask.ctx import AppContext


def test_ParsedQuery_tds_lower_limit(app_context: AppContext) -> None:
def test_ParsedQueryTeradata_lower_limit(app_context: AppContext) -> None:
"""
Test the custom ``ParsedQuery_td`` that calls ``_extract_limit_from_query_td(``
Test the custom ``ParsedQueryTeradata`` that calls ``_extract_limit_from_query_td(``
The CLass looks for Teradata limit keywords TOP and SAMPLE vs LIMIT in
other dialects. and
other dialects.
"""
from superset.db_engine_specs.teradata import TeradataEngineSpec, ParsedQueryTeradata
from superset.db_engine_specs.teradata import TeradataEngineSpec

sql = "SEL TOP 1000 * FROM My_table;"
limit = 100
Expand All @@ -38,8 +36,14 @@ def test_ParsedQuery_tds_lower_limit(app_context: AppContext) -> None:
)


def test_ParsedQuery_tds_higher_limit(app_context: AppContext) -> None:
from superset.db_engine_specs.teradata import TeradataEngineSpec, ParsedQueryTeradata
def test_ParsedQueryTeradata_higher_limit(app_context: AppContext) -> None:
"""
Test the custom ``ParsedQueryTeradata`` that calls ``_extract_limit_from_query_td(``
The CLass looks for Teradata limit keywords TOP and SAMPLE vs LIMIT in
other dialects.
"""
from superset.db_engine_specs.teradata import TeradataEngineSpec

sql = "SEL TOP 1000 * FROM My_table;"
limit = 10000
Expand All @@ -49,14 +53,14 @@ def test_ParsedQuery_tds_higher_limit(app_context: AppContext) -> None:
)


def test_ParsedQuery_tds_equal_limit(app_context: AppContext) -> None:
def test_ParsedQueryTeradata_equal_limit(app_context: AppContext) -> None:
"""
Test the custom ``ParsedQuery_td`` that calls ``_extract_limit_from_query_td(``
Test the custom ``ParsedQueryTeradata`` that calls ``_extract_limit_from_query_td(``
The CLass looks for Teradata limit keywords TOP and SAMPLE vs LIMIT in
other dialects. and
other dialects.
"""
from superset.db_engine_specs.teradata import TeradataEngineSpec, ParsedQueryTeradata
from superset.db_engine_specs.teradata import TeradataEngineSpec

sql = "SEL TOP 1000 * FROM My_table;"
limit = 1000
Expand All @@ -66,14 +70,14 @@ def test_ParsedQuery_tds_equal_limit(app_context: AppContext) -> None:
)


def test_ParsedQuery_tds_no_limit(app_context: AppContext) -> None:
def test_ParsedQueryTeradata_no_limit(app_context: AppContext) -> None:
"""
Test the custom ``ParsedQuery_td`` that calls ``_extract_limit_from_query_td(``
Test the custom ``ParsedQueryTeradata`` that calls ``_extract_limit_from_query_td(``
The CLass looks for Teradata limit keywords TOP and SAMPLE vs LIMIT in
other dialects. and
other dialects.
"""
from superset.db_engine_specs.teradata import TeradataEngineSpec, ParsedQueryTeradata
from superset.db_engine_specs.teradata import TeradataEngineSpec

sql = "SEL * FROM My_table;"
limit = 1000
Expand Down

0 comments on commit 3216e6a

Please sign in to comment.