Skip to content

Commit c64a1d3

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

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

experimental/python/databricks_tests/core/test_resources.py

Lines changed: 14 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,8 +202,21 @@ 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
216+
217+
assert tc.mutator.__name__ in databricks.bundles.core.__all__, (
218+
"mutator is not in databricks.bundles.core.__all__"
219+
)
206220

207221

208222
@pytest.mark.parametrize("tc,tpe", test_cases, ids=test_case_ids)

0 commit comments

Comments
 (0)