Skip to content

Commit

Permalink
add unit test_providers
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Nov 17, 2023
1 parent 1cc6fdf commit 6a37d28
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/unit/test_providers.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/unit/test_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6a37d28

Please sign in to comment.