-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added incremental model and test * working code for incremental tests -- old unit test still works * working code for incremental tests -- old unit test still works * updated comments * moved unit test incremental to its own method * moved unit test incremental to its own method * updates readme and version for incremental tests * Enable macro unit tests (#79) * Added all existing unit tests in macro form. * Refactored the test blocks into macros blocks. Replaced the original code inside the test blocks with the new macros. * Adjusted the render logic for the the input mapping. This has to be done for the values and the keys. This is necessary so that the unit tests can be executed as macros. * Added explanations to the README on how to setup the tests as macros. --------- Co-authored-by: Leopold Gabelmann <[email protected]> * fixes merge issues * minor fixes * oops * thought i got rid of that already * o i see * adds exclude_columns * adds exclude_columns to test * bumps versions --------- Co-authored-by: Petter Söderlund <[email protected]> Co-authored-by: Leopold Gabelmann <[email protected]> Co-authored-by: Leopold Gabelmann <[email protected]>
- Loading branch information
1 parent
15b08bf
commit 5a4c311
Showing
8 changed files
with
107 additions
and
19 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
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,9 @@ | ||
{#- Unit test with seeds as the input as well as the output. -#} | ||
{{ dbt_datamocktool.unit_test( | ||
model = ref('stg_customers'), | ||
input_mapping = { | ||
source('jaffle_shop', 'raw_customers'): ref('dmt__raw_customers_1') | ||
}, | ||
expected_output = ref('dmt__expected_stg_customers_1'), | ||
exclude_columns = ['description'] | ||
) }} |
9 changes: 9 additions & 0 deletions
9
integration_tests/tests/unit/staging/test_stg_customers_macro_input.sql
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,9 @@ | ||
{#- Unit test with macro as the input and a model as the expected output. -#} | ||
{{ dbt_datamocktool.unit_test( | ||
model = ref('stg_customers'), | ||
input_mapping = { | ||
source('jaffle_shop', 'raw_customers'): "{{ dmt_raw_customers() }}" | ||
}, | ||
expected_output = ref('dmt__expected_stg_customers_2'), | ||
name = "This test is a unit test", | ||
) }} |
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,7 @@ | ||
{{ dbt_datamocktool.unit_test( | ||
model = ref('stg_orders'), | ||
input_mapping = { | ||
ref('raw_orders'): ref('dmt__raw_orders_1') | ||
}, | ||
expected_output = ref('dmt__expected_stg_orders_1'), | ||
) }} |
9 changes: 9 additions & 0 deletions
9
integration_tests/tests/unit/staging/test_stg_orders_incremental.sql
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,9 @@ | ||
{#- Unit test with for an incremental model with redefining `{{this}}`. -#} | ||
{{ dbt_datamocktool.unit_test_incremental( | ||
model = ref('stg_orders'), | ||
input_mapping = { | ||
ref('raw_orders'): ref('dmt__raw_orders_3'), | ||
"this": ref('dmt__current_state_orders_2') | ||
}, | ||
expected_output = ref('dmt__expected_stg_orders_2'), | ||
) }} |
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