Skip to content

Commit

Permalink
Add adapter tests for get_powers_of_two macro
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm committed Sep 11, 2023
1 parent 661d006 commit 93e74ba
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/adapter/dbt/tests/adapter/utils/fixture_get_powers_of_two.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# get_powers_of_two

models__test_get_powers_of_two_sql = """
select {{ get_powers_of_two(1) }} as actual, 1 as expected
union all
select {{ get_powers_of_two(4) }} as actual, 2 as expected
union all
select {{ get_powers_of_two(27) }} as actual, 5 as expected
union all
select {{ get_powers_of_two(256) }} as actual, 8 as expected
union all
select {{ get_powers_of_two(3125) }} as actual, 12 as expected
union all
select {{ get_powers_of_two(46656) }} as actual, 16 as expected
union all
select {{ get_powers_of_two(823543) }} as actual, 20 as expected
"""

models__test_get_powers_of_two_yml = """
version: 2
models:
- name: test_powers_of_two
tests:
- assert_equal:
actual: actual
expected: expected
"""
21 changes: 21 additions & 0 deletions tests/adapter/dbt/tests/adapter/utils/test_get_powers_of_two.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest
from dbt.tests.adapter.utils.base_utils import BaseUtils
from dbt.tests.adapter.utils.fixture_get_powers_of_two import (
models__test_get_powers_of_two_sql,
models__test_get_powers_of_two_yml,
)


class BaseGetPowersOfTwo(BaseUtils):
@pytest.fixture(scope="class")
def models(self):
return {
"test_get_powers_of_two.yml": models__test_get_powers_of_two_yml,
"test_get_powers_of_two.sql": self.interpolate_macro_namespace(
models__test_get_powers_of_two_sql, "get_powers_of_two"
),
}


class TestGetPowersOfTwo(BaseGetPowersOfTwo):
pass

0 comments on commit 93e74ba

Please sign in to comment.