-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add adapter tests for
get_powers_of_two
macro
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
tests/adapter/dbt/tests/adapter/utils/fixture_get_powers_of_two.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
tests/adapter/dbt/tests/adapter/utils/test_get_powers_of_two.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |