Skip to content

Commit 87b1adf

Browse files
committed
adding test for date() and datetime() macros
1 parent 34d37d3 commit 87b1adf

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

integration_tests/macros/get_test_dates.sql

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ select
3030
{{ dbt_date.last_month_name(short=True) }} as last_month_name_short,
3131
{{ dbt_date.next_month_number() }} as next_month_number,
3232
{{ dbt_date.next_month_name(short=False) }} as next_month_name,
33-
{{ dbt_date.next_month_name(short=True) }} as next_month_name_short
33+
{{ dbt_date.next_month_name(short=True) }} as next_month_name_short,
34+
{{ modules.datetime.date(1997, 9, 29) }} as datetime_date,
35+
{{ modules.datetime.datetime(1997, 9, 29, 6, 14, modules.pytz.timezone(var("dbt_date:time_zone"))) }} as datetime_datetime
3436

3537
union all
3638

@@ -64,7 +66,9 @@ select
6466
{{ dbt_date.last_month_name(short=True) }} as last_month_name_short,
6567
{{ dbt_date.next_month_number() }} as next_month_number,
6668
{{ dbt_date.next_month_name(short=False) }} as next_month_name,
67-
{{ dbt_date.next_month_name(short=True) }} as next_month_name_short
69+
{{ dbt_date.next_month_name(short=True) }} as next_month_name_short,
70+
{{ modules.datetime.date(1997, 9, 29) }} as datetime_date,
71+
{{ modules.datetime.datetime(1997, 9, 29, 6, 14, modules.pytz.timezone(var("dbt_date:time_zone"))) }} as datetime_datetime
6872

6973
{%- endmacro %}
7074

integration_tests/models/test_dates.yml

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ models:
6565
expression: "next_month_name = {{ dbt_date.next_month_name(short=False) }}"
6666
- expression_is_true:
6767
expression: "next_month_name_short = {{ dbt_date.next_month_name(short=True) }}"
68+
- expression_is_true:
69+
expression: "datetime_date = {{ dbt_date.date(1997, 9, 29) }}"
70+
- expression_is_true:
71+
expression: "datetime_datetime = {{ dbt_date.datetime(1997, 9, 29, 6, 14) }}"
6872

6973

7074
columns:

0 commit comments

Comments
 (0)