Skip to content

A dbt package provides macros for unit testing, inspired by python's unittest module

License

Notifications You must be signed in to change notification settings

yu-iskw/dbt-unittest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbt-unittest

This is a dbt package to enhance dbt package development by providing unit testing macros.

Installation Instructions

Check dbt Hub for the latest installation instructions.

Requirements

  • dbt-core: 1.0.0 or later

Macros in the dbt package

assert_true

Test that expr is true.

Usage:

  {{ dbt_unittest.assert_true(true) }}
  {{ dbt_unittest.assert_true(1 == 1) }}

assert_false

Test that expr is false.

Usage:

  {{ dbt_unittest.assert_false(false) }}
  {{ dbt_unittest.assert_false(1 != 1) }}

assert_is_none

Test that expr is None.

Usage:

  {{ dbt_unittest.assert_is_none(none) }}

assert_is_not_none

Test that expr is not None.

Usage:

  {{ dbt_unittest.assert_is_not_none(none) }}

assert_equals

Test that first and second are equal. If the values do not compare equal, the test will fail.

Usage:

  {{ dbt_unittest.assert_equals("foo", "bar") }}

assert_not_equals

Test that first and second are not equal. If the values do compare equal, the test will fail.

Usage:

  {{ dbt_unittest.assert_not_equals("foo", "bar") }}

assert_in

Test that member is in container.

Usage:

  {{ dbt_unittest.assert_in(1, [1, 2, 3]) }}

assert_not_in

Test that member is not in container.

Usage:

  {{ dbt_unittest.assert_not_in(4, [1, 2, 3]) }}

assert_list_equals

Tests that two lists are equal.

Usage:

  {{ dbt_unittest.assert_list_equals([1, 2, 3], [4, 5]) }}

assert_dict_equals

Test that two dictionaries are equal.

Usage:

  {{ dbt_unittest.assert_dict_equals({"k": 1}, {"k": 1}) }}

Contributors

yu-iskw
Yu Ishikawa
dbeatty10
Doug Beatty
ernestoongaro
Ernesto Ongaro
rlh1994
Ryan Hill