Beispiel #1
0
def test_lazy_syntax_check(frontend, backend):
    """Test syntax checking."""
    lazy_pass = LazyStencil(
        StencilBuilder(copy_stencil_definition, frontend=frontend, backend=backend)
    )
    lazy_fail = LazyStencil(
        StencilBuilder(wrong_syntax_stencil_definition, frontend=frontend, backend=backend)
    )
    lazy_pass.check_syntax()
    with pytest.raises(GTScriptDefinitionError):
        lazy_fail.check_syntax()
Beispiel #2
0
 def _decorator(func):
     _set_arg_dtypes(func, dtypes or {})
     options = gt_definitions.BuildOptions(
         **{
             **StencilBuilder.default_options_dict(func),
             **StencilBuilder.name_to_options_args(name),
             "rebuild": rebuild,
             "build_info": build_info,
             **StencilBuilder.nest_impl_options(kwargs),
         })
     stencil = LazyStencil(
         StencilBuilder(func, backend=backend,
                        options=options).with_externals(externals or {}))
     if eager:
         stencil = stencil.implementation
     elif check_syntax:
         stencil.check_syntax()
     return stencil