1+ -- test not_null
2+ {% set result_node = {
3+ " test_metadata" : {
4+ " name" : " not_null" ,
5+ " kwargs" : {
6+ " column_name" : " indicator_category" ,
7+ " model" : " {{ get_where_subquery(ref('bi_column_analysis')) }}"
8+ },
9+ }
10+ } %}
11+
12+ select ' {{ dq_tools.__get_test_description(result_node) }}' as actual,
13+ ' The indicator_category column in the bi_column_analysis model should not contain null values.' as expected
14+
15+ -- test unique
16+ {% set result_node = {
17+ " test_metadata" : {
18+ " name" : " unique" ,
19+ " kwargs" : {
20+ " column_name" : " invocation_id" ,
21+ " model" : " {{ get_where_subquery(ref('test_coverage')) }}"
22+ }
23+ }
24+ } %}
25+
26+ union all
27+ select ' {{ dq_tools.__get_test_description(result_node) }}' as actual,
28+ ' The invocation_id column in the test_coverage model should be unique.' as expected
29+
30+ -- test relationships
31+ {% set result_node = {
32+
33+ " test_metadata" : {
34+ " name" : " relationships" ,
35+ " kwargs" : {
36+ " to" : " ref('data_test_relationships_a')" ,
37+ " field" : " a_id" ,
38+ " column_name" : " b_id" ,
39+ " model" : " {{ get_where_subquery(ref('data_test_relationships_b')) }}"
40+ }
41+ }
42+ } %}
43+
44+ union all
45+ select ' {{ dq_tools.__get_test_description((result_node)) }}' as actual,
46+ ' Each b_id in the data_test_relationships_b model exists as an id in the data_test_relationships_a table.' as expected
47+
48+ -- test no test description
49+ {% set result_node = {
50+ " test_metadata" : {
51+ " name" : " not_null_where_db" ,
52+ " kwargs" : {
53+ " column_name" : " check_timestamp" ,
54+ " model" : " {{ get_where_subquery(ref('dq_tools_test')) }}"
55+ }
56+ }
57+ } %}
58+
59+ union all
60+ select ' {{ dq_tools.__get_test_description(result_node) }}' as actual,
61+ ' ' as expected
62+
63+ {% set result_node = {
64+ " test_metadata" : {
65+ " name" : " accepted_values" ,
66+ " kwargs" : {
67+ " values" : [
68+ " Simple Statistics"
69+ ],
70+ " column_name" : " indicator_category" ,
71+ " model" : " {{ get_where_subquery(ref('bi_dq_metrics')) }}"
72+ },
73+ " namespace" : null
74+ },
75+ " description" : " The indicator_category column should only contain simple statistics value"
76+ } %}
77+
78+ union all
79+ select
80+ ' {{ dq_tools.__get_test_description(result_node) }}' as actual,
81+ ' The indicator_category column should only contain simple statistics value' as expected
0 commit comments