Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add tests for this macro
  • Loading branch information
VersusFacit committed May 24, 2023
commit 1c3f5b575d9c520ef7e84fa41d5bd2196000d454
22 changes: 20 additions & 2 deletions tests/adapter/dbt/tests/adapter/utils/fixture_null_compare.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
models__test_null_compare_sql = """
MODELS__TEST_MIXED_NULL_COMPARE_SQL = """
select
1 as actual,
null as expected
"""


MODELS__TEST_MIXED_NULL_COMPARE_YML = """
version: 2
models:
- name: test_null_compare
tests:
- assert_equal:
actual: actual
expected: expected
"""


MODELS__TEST_NULL_COMPARE_SQL = """
select
null as actual,
null as expected
"""


models__test_null_compare_yml = """
MODELS__TEST_NULL_COMPARE_YML = """
version: 2
models:
- name: test_null_compare
Expand Down
28 changes: 24 additions & 4 deletions tests/adapter/dbt/tests/adapter/utils/test_null_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@

from dbt.tests.adapter.utils.base_utils import BaseUtils
from dbt.tests.adapter.utils.fixture_null_compare import (
models__test_null_compare_sql,
models__test_null_compare_yml,
MODELS__TEST_MIXED_NULL_COMPARE_SQL,
MODELS__TEST_MIXED_NULL_COMPARE_YML,
MODELS__TEST_NULL_COMPARE_SQL,
MODELS__TEST_NULL_COMPARE_YML,
)
from dbt.tests.util import run_dbt


class BaseMixedNullCompare(BaseUtils):
@pytest.fixture(scope="class")
def models(self):
return {
"test_mixed_null_compare.yml": MODELS__TEST_MIXED_NULL_COMPARE_SQL,
"test_mixed_null_compare.sql": MODELS__TEST_MIXED_NULL_COMPARE_YML,
}

def test_build_assert_equal(self, project):
run_dbt()
run_dbt(["test"], expect_pass=False)


class BaseNullCompare(BaseUtils):
@pytest.fixture(scope="class")
def models(self):
return {
"test_null_compare.yml": models__test_null_compare_yml,
"test_null_compare.sql": models__test_null_compare_sql,
"test_null_compare.yml": MODELS__TEST_NULL_COMPARE_YML,
"test_null_compare.sql": MODELS__TEST_NULL_COMPARE_SQL,
}


class TestMixedNullCompare(BaseNullCompare):
pass


class TestNullCompare(BaseNullCompare):
pass