I would like to test a custom L2 Construct that I wrote and would like to use synthScope to do so, however there are no examples on how to use this in Python, I think it is broken I am getting the following error with this code, which I believe is what it would be like had the Javascript been written in Python
elif isinstance(d, (FunctionType, MethodType, BuiltinFunctionType, LambdaType)):
# Whether a given object is a function-like object.
# We won't use iscallable() since objects may implement __call__()
# but we still want to serialize them as normal.
> raise JSIIError(
"Cannot pass function as argument here (did you mean to call this function?): %r"
% d
)
E jsii.errors.JSIIError: Cannot pass function as argument here (did you mean to call this function?): <function test_keyvault_martin.<locals>.test_setup at 0x16b938860>
def test_resource_group():
def test_setup(scope: Construct):
rg = ResourceGroup(scope, "test", location="West Europe", name="rg")
synthesized = Testing.synth_scope(lambda scope: test_setup(scope))
assert Testing.to_have_resource_with_properties(
synthesized, ResourceGroup.TF_RESOURCE_TYPE, {"name": "rg", "location": "West Europe"}
)