class_docstr: Test the basic error handling / validation in pymil.
class_docstr_tok: ["Test","the","basic","error","handling","\/","validation","in","pymil","."]
docstr: The builder should error out early when detecting the input type violation against the defined type_domain
docstr_tok: ["The","builder","should","error","out","early","when","detecting","the","input","type","violation","against","the","defined","type_domain"]
code: def test_type_domain_validation():
      """
      The builder should error out early when detecting the input type violation against the defined type_domain
      """
      expected_err_str = "In op, of type rsqrt, named rsqrt_0, the named input `epsilon` must have the same data type as the named input `x`. However, epsilon has dtype int32 whereas x has dtype fp32"
      with pytest.raises(ValueError, match=expected_err_str):
  
          @mb.program(
              input_specs=[mb.TensorSpec(shape=(2,), dtype=types.fp32)]
          )
          def prog(x):
              res = mb.rsqrt(x=x, epsilon=1)
              return res
  
imports: import numpy
  import pytest
  import coremltools
  from coremltools import _logger
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, Program, types
  from coremltools.converters.mil.mil.passes.tests.test_passes import CONSTEXPR_FUNCS
label_desc: Use image node_id 1 for calling the TestMILBasic obj's underlying member method code with example usage: obj.test_type_domain_validation() and returns: res