Skip to content

Commit

Permalink
update tests: -> data_tests: (#893)
Browse files Browse the repository at this point in the history
* update tests: -> data_tests:

* bump require-dbt-version

* undo change to require-dbt-version

* Update README.md

---------

Co-authored-by: Doug Beatty <[email protected]>
  • Loading branch information
graciegoheen and dbeatty10 authored May 22, 2024
1 parent 70e2b04 commit fc98e4e
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ Certain tests support the optional `group_by_columns` argument to provide more g
- Some data checks can only be expressed within a group (e.g. ID values should be unique within a group but can be repeated between groups)
- Some data checks are more precise when done by group (e.g. not only should table rowcounts be equal but the counts within each group should be equal)

This feature is currently available for the following tests:
This feature is currently available for the following data tests:

- equal_rowcount()
- fewer_rows_than()
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/data/schema_tests/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ seeds:
- name: data_test_sequential_values
columns:
- name: my_even_sequence
tests:
data_tests:
- dbt_utils.sequential_values:
interval: 2
- dbt_utils.sequential_values:
Expand All @@ -15,7 +15,7 @@ seeds:
- name: data_test_sequential_timestamps
columns:
- name: my_timestamp
tests:
data_tests:
- dbt_utils.sequential_values:
interval: 1
datepart: 'hour'
2 changes: 1 addition & 1 deletion integration_tests/models/datetime/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ version: 2

models:
- name: test_date_spine
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('data_date_spine')
50 changes: 25 additions & 25 deletions integration_tests/models/generic_tests/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ seeds:
- name: data_test_not_constant
columns:
- name: field
tests:
data_tests:
- dbt_utils.not_constant
- dbt_utils.not_constant:
group_by_columns: ['col_a']

- name: data_test_at_least_one
columns:
- name: field
tests:
data_tests:
- dbt_utils.at_least_one
- dbt_utils.at_least_one:
group_by_columns: ['field']

- name: data_test_expression_is_true
tests:
data_tests:
- dbt_utils.expression_is_true:
expression: col_a + col_b = 1
- dbt_utils.expression_is_true:
Expand All @@ -27,11 +27,11 @@ seeds:
where: col_b = 0.5
columns:
- name: col_a
tests:
data_tests:
- dbt_utils.expression_is_true:
expression: + col_b = 1
- name: col_b
tests:
data_tests:
- dbt_utils.expression_is_true:
expression: = 0.5
config:
Expand All @@ -40,36 +40,36 @@ seeds:
- name: data_people
columns:
- name: is_active
tests:
data_tests:
- dbt_utils.cardinality_equality:
field: is_active
to: ref('data_people')

- name: data_test_not_accepted_values
columns:
- name: city
tests:
data_tests:
- dbt_utils.not_accepted_values:
values: ['Madrid', 'Berlin']

- name: data_test_relationships_where_table_2
columns:
- name: id
tests:
data_tests:
- dbt_utils.relationships_where:
to: ref('data_test_relationships_where_table_1')
field: id
from_condition: id <> 4

- name: data_test_mutually_exclusive_ranges_no_gaps
tests:
data_tests:
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: lower_bound
upper_bound_column: upper_bound
gaps: not_allowed

- name: data_test_mutually_exclusive_ranges_with_gaps
tests:
data_tests:
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: valid_from
upper_bound_column: coalesce(valid_to, '2099-01-01')
Expand All @@ -83,15 +83,15 @@ seeds:
gaps: required

- name: data_test_mutually_exclusive_ranges_with_gaps_zero_length
tests:
data_tests:
- dbt_utils.mutually_exclusive_ranges:
lower_bound_column: valid_from
upper_bound_column: valid_to
partition_by: subscription_id
zero_length_range_allowed: true

- name: data_unique_combination_of_columns
tests:
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- month
Expand All @@ -100,7 +100,7 @@ seeds:
- name: data_cardinality_equality_a
columns:
- name: same_name
tests:
data_tests:
- dbt_utils.cardinality_equality:
to: ref('data_cardinality_equality_b')
field: same_name
Expand All @@ -111,7 +111,7 @@ seeds:
- name: data_test_accepted_range
columns:
- name: id
tests:
data_tests:
- dbt_utils.accepted_range:
min_value: -1
max_value: 11
Expand All @@ -130,20 +130,20 @@ seeds:
- name: data_not_null_proportion
columns:
- name: point_5
tests:
data_tests:
- dbt_utils.not_null_proportion:
at_least: 0.5
at_most: 0.5
- dbt_utils.not_null_proportion:
at_least: 0
group_by_columns: ['point_9']
- name: point_9
tests:
data_tests:
- dbt_utils.not_null_proportion:
at_least: 0.9

- name: data_test_equality_a
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('data_test_equality_a')
- dbt_utils.equality:
Expand All @@ -161,7 +161,7 @@ seeds:
- col_c

- name: data_test_equality_floats_a
tests:
data_tests:
# test precision only
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_b')
Expand All @@ -173,7 +173,7 @@ seeds:
warn_if: "<0"

- name: data_test_equality_floats_columns_a
tests:
data_tests:
# Positive assertion tests
- dbt_utils.equality:
compare_model: ref('data_test_equality_floats_columns_b')
Expand All @@ -195,7 +195,7 @@ seeds:

models:
- name: recency_time_included
tests:
data_tests:
- dbt_utils.recency:
datepart: day
field: created_at
Expand All @@ -212,7 +212,7 @@ models:
group_by_columns: ['col1', 'col2']

- name: recency_time_excluded
tests:
data_tests:
- dbt_utils.recency:
datepart: day
field: created_at
Expand All @@ -227,15 +227,15 @@ models:
warn_if: "<0"

- name: test_equal_rowcount
tests:
data_tests:
- dbt_utils.equal_rowcount:
compare_model: ref('test_equal_rowcount')
- dbt_utils.equal_rowcount:
compare_model: ref('test_equal_rowcount')
group_by_columns: ['field']

- name: test_equal_column_subset
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('data_people')
compare_columns:
Expand All @@ -244,15 +244,15 @@ models:
- email

- name: test_fewer_rows_than
tests:
data_tests:
- dbt_utils.fewer_rows_than:
compare_model: ref('data_test_fewer_rows_than_table_2')
- dbt_utils.fewer_rows_than:
compare_model: ref('data_test_fewer_rows_than_table_2')
group_by_columns: ['col_a']

- name: equality_less_columns
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('data_test_equality_a')
exclude_columns:
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/models/geo/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ version: 2

models:
- name: test_haversine_distance_km
tests:
data_tests:
- assert_equal:
actual: actual
expected: expected
- name: test_haversine_distance_mi
tests:
data_tests:
- assert_equal:
actual: actual
expected: expected
Loading

0 comments on commit fc98e4e

Please sign in to comment.