-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Redshift] Add tests for unit testing (#680)
* first pass * fix dbt-common version * try to fix dbt-postgres version * fix import * array and json types as TODO * add json test, TestRedshiftUnitTestCaseInsensitivity, TestRedshiftUnitTestInvalidInput * restore requirements --------- Co-authored-by: Mike Alfare <[email protected]>
- Loading branch information
1 parent
24673f8
commit 6906eb0
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
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
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
42 changes: 42 additions & 0 deletions
42
tests/functional/adapter/unit_testing/test_unit_testing.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,42 @@ | ||
import pytest | ||
from dbt.tests.adapter.unit_testing.test_types import BaseUnitTestingTypes | ||
from dbt.tests.adapter.unit_testing.test_case_insensitivity import BaseUnitTestCaseInsensivity | ||
from dbt.tests.adapter.unit_testing.test_invalid_input import BaseUnitTestInvalidInput | ||
|
||
|
||
class TestRedshiftUnitTestingTypes(BaseUnitTestingTypes): | ||
@pytest.fixture | ||
def data_types(self): | ||
# sql_value, yaml_value | ||
return [ | ||
["1", "1"], | ||
["1.0", "1.0"], | ||
["'1'", "1"], | ||
["'1'::numeric", "1"], | ||
["'string'", "string"], | ||
["true", "true"], | ||
["DATE '2020-01-02'", "2020-01-02"], | ||
["TIMESTAMP '2013-11-03 00:00:00-0'", "2013-11-03 00:00:00-0"], | ||
["TIMESTAMPTZ '2013-11-03 00:00:00-0'", "2013-11-03 00:00:00-0"], | ||
[ | ||
"""JSON_PARSE('{"bar": "baz", "balance": 7.77, "active": false}')""", | ||
"""'{"bar": "baz", "balance": 7.77, "active": false}'""", | ||
], | ||
# TODO: array types | ||
# ["ARRAY[1,2,3]", """'{1, 2, 3}'"""], | ||
# ["ARRAY[1.0,2.0,3.0]", """'{1.0, 2.0, 3.0}'"""], | ||
# ["ARRAY[1::numeric,2::numeric,3::numeric]", """'{1.0, 2.0, 3.0}'"""], | ||
# ["ARRAY['a','b','c']", """'{"a", "b", "c"}'"""], | ||
# ["ARRAY[true,true,false]", """'{true, true, false}'"""], | ||
# ["ARRAY[DATE '2020-01-02']", """'{"2020-01-02"}'"""], | ||
# ["ARRAY[TIMESTAMP '2013-11-03 00:00:00-0']", """'{"2013-11-03 00:00:00-0"}'"""], | ||
# ["ARRAY[TIMESTAMPTZ '2013-11-03 00:00:00-0']", """'{"2013-11-03 00:00:00-0"}'"""], | ||
] | ||
|
||
|
||
class TestRedshiftUnitTestCaseInsensitivity(BaseUnitTestCaseInsensivity): | ||
pass | ||
|
||
|
||
class TestRedshiftUnitTestInvalidInput(BaseUnitTestInvalidInput): | ||
pass |