diff --git a/tests/unit/test_providers.py b/tests/unit/test_providers.py new file mode 100644 index 00000000000..1fa5cdc269a --- /dev/null +++ b/tests/unit/test_providers.py @@ -0,0 +1,28 @@ +import pytest +from unittest import mock + +from dbt.context.providers import BaseResolver + + +class TestBaseResolver: + class ResolverSubclass(BaseResolver): + def __call__(self, *args: str): + pass + + @pytest.fixture + def resolver(self): + return self.ResolverSubclass( + db_wrapper=mock.Mock(), + model=mock.Mock(), + config=mock.Mock(), + manifest=mock.Mock(), + ) + + @pytest.mark.parametrize( + "empty,expected_resolve_limit", + [(False, None), (True, 0)], + ) + def test_resolve_limit(self, resolver, empty, expected_resolve_limit): + resolver.config.args.EMPTY = empty + + assert resolver.resolve_limit == expected_resolve_limit diff --git a/tests/unit/test_relation.py b/tests/unit/test_relation.py index d8f464b473b..e4d90c4b504 100644 --- a/tests/unit/test_relation.py +++ b/tests/unit/test_relation.py @@ -65,3 +65,4 @@ def test_render_limited(limit, expected_result): ) actual_result = my_relation.render_limited() assert actual_result == expected_result + assert str(my_relation) == expected_result