(
    context: Dict[str, Any],
    node: Union[ParsedGenericTestNode, CompiledGenericTestNode],
    capture_macros: bool = False,
)
Render each of the test kwargs in the given context using the native
    renderer, then insert that value into the given context as the special test
    keyword arguments member.
Render each of the test kwargs in the given context using the native
    renderer, then insert that value into the given context as the special test
    keyword arguments member.
Render each of the test kwargs in the given context using the native renderer then insert that value into the given context as the special test keyword arguments member .
def add_rendered_test_kwargs(
    context: Dict[str, Any],
    node: Union[ParsedGenericTestNode, CompiledGenericTestNode],
    capture_macros: bool = False,
) -> None:
    """Render each of the test kwargs in the given context using the native
    renderer, then insert that value into the given context as the special test
    keyword arguments member.
    """
    looks_like_func = r'^\s*(env_var|ref|var|source|doc)\s*\(.+\)\s*$'

    def _convert_function(
        value: Any, keypath: Tuple[Union[str, int], ...]
    ) -> Any:
        if isinstance(value, str):
            if keypath == ('column_name',):
                # special case: Don't render column names as native, make them
                # be strings
                return value

            if re.match(looks_like_func, value) is not None:
                # curly braces to make rendering happy
                value = f'{{{{ {value} }}}}'

            value = get_rendered(
                value, context, node, capture_macros=capture_macros,
                native=True
            )

        return value

    # The test_metadata.kwargs come from the test builder, and were set
    # when the test node was created in _parse_generic_test.
    kwargs = deep_map_render(_convert_function, node.test_metadata.kwargs)
    context[GENERIC_TEST_KWARGS_NAME] = kwargs
def add_rendered_test_kwargs ( context : Dict [ str , Any ] , node : Union [ ParsedGenericTestNode , CompiledGenericTestNode ] , capture_macros : bool = False , ) -> None : looks_like_func = r'^\s*(env_var|ref|var|source|doc)\s*\(.+\)\s*$' def _convert_function ( value : Any , keypath : Tuple [ Union [ str , int ] , ... ] ) -> Any : if isinstance ( value , str ) : if keypath == ( 'column_name' , ) : # special case: Don't render column names as native, make them # be strings return value if re . match ( looks_like_func , value ) is not None : # curly braces to make rendering happy value = f'{{{{ {value} }}}}' value = get_rendered ( value , context , node , capture_macros = capture_macros , native = True ) return value # The test_metadata.kwargs come from the test builder, and were set # when the test node was created in _parse_generic_test. kwargs = deep_map_render ( _convert_function , node . test_metadata . kwargs ) context [ GENERIC_TEST_KWARGS_NAME ] = kwargs