Skip to content

Commit

Permalink
fix split parts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicor88 committed Aug 21, 2023
1 parent ced631a commit 905ec93
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
39 changes: 39 additions & 0 deletions tests/functional/adapter/fixture_split_parts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
models__test_split_part_sql = """
with data as (
select * from {{ ref('data_split_part') }}
)
select
{{ split_part('parts', 'split_on', 1) }} as actual,
result_1 as expected
from data
union all
select
{{ split_part('parts', 'split_on', 2) }} as actual,
result_2 as expected
from data
union all
select
{{ split_part('parts', 'split_on', 3) }} as actual,
result_3 as expected
from data
"""

models__test_split_part_yml = """
version: 2
models:
- name: test_split_part
tests:
- assert_equal:
actual: actual
expected: expected
"""
11 changes: 10 additions & 1 deletion tests/functional/adapter/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
models__test_datediff_sql,
seeds__data_datediff_csv,
)
from tests.functional.adapter.fixture_split_parts import (
models__test_split_part_sql,
models__test_split_part_yml,
)

from dbt.tests.adapter.utils.fixture_datediff import models__test_datediff_yml
from dbt.tests.adapter.utils.test_any_value import BaseAnyValue
Expand Down Expand Up @@ -100,7 +104,12 @@ class TestRight(BaseRight):


class TestSplitPart(BaseSplitPart):
pass
@pytest.fixture(scope="class")
def models(self):
return {
"test_split_part.yml": models__test_split_part_yml,
"test_split_part.sql": self.interpolate_macro_namespace(models__test_split_part_sql, "split_part"),
}


class TestStringLiteral(BaseStringLiteral):
Expand Down

0 comments on commit 905ec93

Please sign in to comment.