Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
Signed-off-by: popcorny <[email protected]>
  • Loading branch information
popcornylu committed Jan 17, 2025
1 parent 3096708 commit 2035e6b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tests/adapter/dbt_adapter/test_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_select(dbt_test_helper):
"""

dbt_test_helper.create_model("customers_1", csv_data_base, csv_data_curr)
dbt_test_helper.create_model("customers_2", csv_data_base, csv_data_base, ["customers_1"])
dbt_test_helper.create_model("customers_2", csv_data_base, csv_data_base, depends_on=["customers_1"])
adapter: DbtAdapter = dbt_test_helper.context.adapter

# Test methods
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_select(dbt_test_helper):

# Test resource type: snapshot
dbt_test_helper.create_snapshot("snapshot_1", csv_data_base, csv_data_curr)
dbt_test_helper.create_model("use_snapshot", csv_data_base, csv_data_base, ["snapshot_1"])
dbt_test_helper.create_model("use_snapshot", csv_data_base, csv_data_base, depends_on=["snapshot_1"])

node_ids = adapter.select_nodes('resource_type:snapshot')
assert len(node_ids) == 1
Expand Down
5 changes: 3 additions & 2 deletions tests/tasks/test_row_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ def test_row_count_with_selector(dbt_test_helper):
2,Bob,25
"""

dbt_test_helper.create_model("model_1", csv_data_1, csv_data_2, [])
dbt_test_helper.create_model("model_2", csv_data_1, csv_data_1, ['model_1'], package_name='other_package')
dbt_test_helper.create_model("model_1", csv_data_1, csv_data_2, depends_on=[])
dbt_test_helper.create_model("model_2", csv_data_1, csv_data_1, depends_on=['model_1'],
package_name='other_package')
task = RowCountDiffTask(dict(select='model_1'))
run_result = task.execute()
assert len(run_result) == 1
Expand Down
30 changes: 14 additions & 16 deletions tests/util/test_breaking.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import textwrap
import unittest

import pytest

from recce.util.breaking import is_breaking_change


Expand Down Expand Up @@ -108,20 +106,20 @@ def test_breaking_change_remove_column(self):
"""
assert is_breaking_change(original_sql, modified_sql)

@pytest.mark.skip("The case when cannot be detected by sqlglot")
def test_non_breaking_change_add_column_by_case_when(self):
original_sql = """
select
a
from MyTable
"""
modified_sql = """
select
a,
case when a > 100 then 1 else 0 end as b
from MyTable
"""
assert not is_breaking_change(original_sql, modified_sql)
# @pytest.mark.skip("The case when cannot be detected by sqlglot")
# def test_non_breaking_change_add_column_by_case_when(self):
# original_sql = """
# select
# a
# from MyTable
# """
# modified_sql = """
# select
# a,
# case when a > 100 then 1 else 0 end as b
# from MyTable
# """
# assert not is_breaking_change(original_sql, modified_sql)

def test_breaking_change_add_filter(self):
original_sql = """
Expand Down

0 comments on commit 2035e6b

Please sign in to comment.