Skip to content

Commit

Permalink
migrate to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Feb 2, 2022
1 parent 7b899b1 commit 1e43f62
Show file tree
Hide file tree
Showing 2 changed files with 275 additions and 247 deletions.
10 changes: 4 additions & 6 deletions tests/unit_tests/db_engine_specs/test_kusto.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import pytest
from flask.ctx import AppContext

from tests.unit_tests.fixtures.common import dttm


@pytest.mark.parametrize(
"sql,expected",
Expand Down Expand Up @@ -119,16 +121,14 @@ def test_kql_parse_sql(app_context: AppContext) -> None:
],
)
def test_kql_convert_dttm(
app_context: AppContext, target_type: str, expected_dttm: str
app_context: AppContext, target_type: str, expected_dttm: str, dttm: datetime,
) -> None:
"""
Test that date objects are converted correctly.
"""

from superset.db_engine_specs.kusto import KustoKqlEngineSpec

dttm = datetime.strptime("2019-01-02 03:04:05.678900", "%Y-%m-%d %H:%M:%S.%f")
print(dttm)
assert expected_dttm == KustoKqlEngineSpec.convert_dttm(target_type, dttm)


Expand All @@ -142,14 +142,12 @@ def test_kql_convert_dttm(
],
)
def test_sql_convert_dttm(
app_context: AppContext, target_type: str, expected_dttm: str
app_context: AppContext, target_type: str, expected_dttm: str, dttm: datetime,
) -> None:
"""
Test that date objects are converted correctly.
"""

from superset.db_engine_specs.kusto import KustoSqlEngineSpec

dttm = datetime.strptime("2019-01-02 03:04:05.678900", "%Y-%m-%d %H:%M:%S.%f")
print(dttm)
assert expected_dttm == KustoSqlEngineSpec.convert_dttm(target_type, dttm)
Loading

0 comments on commit 1e43f62

Please sign in to comment.