Skip to content

Commit 99bf0bd

Browse files
committed
[Python] Extend test_resources.py
1 parent 0a7bd1a commit 99bf0bd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

experimental/python/databricks_tests/core/test_resources.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55

66
from databricks.bundles.core import Location, Resources, Severity
7+
from databricks.bundles.core._bundle import Bundle
78
from databricks.bundles.core._resource import Resource
89
from databricks.bundles.core._resource_mutator import (
910
ResourceMutator,
@@ -201,9 +202,19 @@ def test_mutator(tc: TestCase, tpe: _ResourceType):
201202
def my_func(bundle, resource):
202203
return resource
203204

205+
bundle = Bundle(target="default")
206+
204207
assert isinstance(my_func, ResourceMutator)
208+
assert tc.mutator.__name__ == tpe.singular_name + "_mutator"
205209
assert my_func.resource_type == tpe.resource_type
210+
assert my_func.function(bundle, tc.dataclass_example) is tc.dataclass_example
211+
212+
213+
@pytest.mark.parametrize("tc,tpe", test_cases, ids=test_case_ids)
214+
def test_mutator_export(tc: TestCase, tpe: _ResourceType):
215+
import databricks.bundles.core
206216

217+
assert tc.mutator.__name__ in databricks.bundles.core.__all__, "mutator is not in databricks.bundles.core.__all__"
207218

208219
@pytest.mark.parametrize("tc,tpe", test_cases, ids=test_case_ids)
209220
def test_add_duplicate_resource(tc: TestCase, tpe: _ResourceType):

0 commit comments

Comments
 (0)