Skip to content

Commit

Permalink
more accurate ut
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Mar 17, 2022
1 parent b74937b commit 1d719be
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/integration_tests/sqla_models_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,11 @@ def test_should_generate_closed_and_open_time_filter_range():
table = SqlaTable(
table_name="temporal_column_table",
sql=(
"SELECT '2022-01-01'::timestamp as datetime_col"
" UNION SELECT '2023-01-01'::timestamp"
"SELECT '2021-12-31'::timestamp as datetime_col "
"UNION SELECT '2022-01-01'::timestamp "
"UNION SELECT '2022-03-10'::timestamp "
"UNION SELECT '2023-01-01'::timestamp "
"UNION SELECT '2023-03-10'::timestamp "
),
database=get_example_database(),
)
Expand All @@ -636,12 +639,15 @@ def test_should_generate_closed_and_open_time_filter_range():
""" >>> result_object.query
SELECT count(*) AS count
FROM
(SELECT '2022-01-01'::timestamp as datetime_col
UNION SELECT '2023-01-01'::timestamp) AS virtual_table
(SELECT '2021-12-31'::timestamp as datetime_col
UNION SELECT '2022-01-01'::timestamp
UNION SELECT '2022-03-10'::timestamp
UNION SELECT '2023-01-01'::timestamp
UNION SELECT '2023-03-10'::timestamp) AS virtual_table
WHERE datetime_col >= TO_TIMESTAMP('2022-01-01 00:00:00.000000', 'YYYY-MM-DD HH24:MI:SS.US')
AND datetime_col < TO_TIMESTAMP('2023-01-01 00:00:00.000000', 'YYYY-MM-DD HH24:MI:SS.US')
"""
assert result_object.df.iloc[0]["count"] == 1
assert result_object.df.iloc[0]["count"] == 2


@pytest.mark.parametrize(
Expand Down

0 comments on commit 1d719be

Please sign in to comment.