def test_format_descriptors(): from pybind11_tests import get_format_unbound, print_format_descriptors with pytest.raises(RuntimeError) as excinfo: get_format_unbound() assert re.match('^NumPy type info missing for .*UnboundStruct.*$', str(excinfo.value)) ld = np.dtype('longdouble') ldbl_fmt = ('4x' if ld.alignment > 4 else '') + ld.char ss_fmt = "^T{?:bool_:3xI:uint_:f:float_:" + ldbl_fmt + ":ldbl_:}" dbl = np.dtype('double') partial_fmt = ("^T{?:bool_:3xI:uint_:f:float_:" + str(4 * (dbl.alignment > 4) + dbl.itemsize + 8 * (ld.alignment > 8)) + "xg:ldbl_:}") nested_extra = str(max(8, ld.alignment)) assert print_format_descriptors() == [ ss_fmt, "^T{?:bool_:I:uint_:f:float_:g:ldbl_:}", "^T{" + ss_fmt + ":a:^T{?:bool_:I:uint_:f:float_:g:ldbl_:}:b:}", partial_fmt, "^T{" + nested_extra + "x" + partial_fmt + ":a:" + nested_extra + "x}", "^T{3s:a:3s:b:}", "^T{(3)4s:a:(2)i:b:(3)B:c:1x(4, 2)f:d:}", '^T{q:e1:B:e2:}', '^T{Zf:cflt:Zd:cdbl:}' ]
def test_format_descriptors(): from pybind11_tests import get_format_unbound, print_format_descriptors with pytest.raises(RuntimeError) as excinfo: get_format_unbound() assert 'unsupported buffer format' in str(excinfo.value) assert print_format_descriptors() == [ "T{=?:x:3x=I:y:=f:z:}", "T{=?:x:=I:y:=f:z:}", "T{=T{=?:x:3x=I:y:=f:z:}:a:=T{=?:x:=I:y:=f:z:}:b:}", "T{=?:x:3x=I:y:=f:z:12x}", "T{8x=T{=?:x:3x=I:y:=f:z:12x}:a:8x}", "T{=3s:a:=3s:b:}" ]
def test_format_descriptors(): from pybind11_tests import get_format_unbound, print_format_descriptors with pytest.raises(RuntimeError) as excinfo: get_format_unbound() assert re.match('^NumPy type info missing for .*UnboundStruct.*$', str(excinfo.value)) assert print_format_descriptors() == [ "T{?:x:3xI:y:f:z:}", "T{?:x:=I:y:=f:z:}", "T{T{?:x:3xI:y:f:z:}:a:T{?:x:=I:y:=f:z:}:b:}", "T{?:x:3xI:y:f:z:12x}", "T{8xT{?:x:3xI:y:f:z:12x}:a:8x}", "T{3s:a:3s:b:}", 'T{q:e1:B:e2:}' ]
def test_format_descriptors(): from pybind11_tests import get_format_unbound, print_format_descriptors with pytest.raises(RuntimeError) as excinfo: get_format_unbound() assert re.match('^NumPy type info missing for .*UnboundStruct.*$', str(excinfo.value)) assert print_format_descriptors() == [ "T{=?:x:3x=I:y:=f:z:}", "T{=?:x:=I:y:=f:z:}", "T{=T{=?:x:3x=I:y:=f:z:}:a:=T{=?:x:=I:y:=f:z:}:b:}", "T{=?:x:3x=I:y:=f:z:12x}", "T{8x=T{=?:x:3x=I:y:=f:z:12x}:a:8x}", "T{=3s:a:=3s:b:}", 'T{=q:e1:=B:e2:}' ]
def test_format_descriptors(): from pybind11_tests import get_format_unbound, print_format_descriptors with pytest.raises(RuntimeError) as excinfo: get_format_unbound() assert 'unsupported buffer format' in str(excinfo.value) assert print_format_descriptors() == [ "T{=?:x:3x=I:y:=f:z:}", "T{=?:x:=I:y:=f:z:}", "T{=T{=?:x:3x=I:y:=f:z:}:a:=T{=?:x:=I:y:=f:z:}:b:}", "T{=?:x:3x=I:y:=f:z:12x}", "T{8x=T{=?:x:3x=I:y:=f:z:12x}:a:8x}", "T{=3s:a:=3s:b:}", 'T{=q:e1:=B:e2:}' ]
def test_format_descriptors(): from pybind11_tests import get_format_unbound, print_format_descriptors with pytest.raises(RuntimeError) as excinfo: get_format_unbound() assert re.match('^NumPy type info missing for .*UnboundStruct.*$', str(excinfo.value)) ld = np.dtype('longdouble') ldbl_fmt = ('4x' if ld.alignment > 4 else '') + ld.char ss_fmt = "T{?:bool_:3xI:uint_:f:float_:" + ldbl_fmt + ":ldbl_:}" dbl = np.dtype('double') partial_fmt = ("T{?:bool_:3xI:uint_:f:float_:" + str(4 * (dbl.alignment > 4) + dbl.itemsize + 8 * (ld.alignment > 8)) + "xg:ldbl_:}") nested_extra = str(max(8, ld.alignment)) assert print_format_descriptors() == [ ss_fmt, "T{?:bool_:^I:uint_:^f:float_:^g:ldbl_:}", "T{" + ss_fmt + ":a:T{?:bool_:^I:uint_:^f:float_:^g:ldbl_:}:b:}", partial_fmt, "T{" + nested_extra + "x" + partial_fmt + ":a:" + nested_extra + "x}", "T{3s:a:3s:b:}", 'T{q:e1:B:e2:}' ]