MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_numpy_bool

Function test_numpy_bool

tests/test_builtin_casters.py:583–596  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

581
582
583def test_numpy_bool():
584 np = pytest.importorskip("numpy")
585
586 convert, noconvert = m.bool_passthrough, m.bool_passthrough_noconvert
587
588 def cant_convert(v):
589 pytest.raises(TypeError, convert, v)
590
591 # np.bool_ is not considered implicit
592 assert convert(np.bool_(True)) is True
593 assert convert(np.bool_(False)) is False
594 assert noconvert(np.bool_(True)) is True
595 assert noconvert(np.bool_(False)) is False
596 cant_convert(np.zeros(2, dtype="int"))
597
598
599def test_int_long():

Callers

nothing calls this directly

Calls 2

cant_convertFunction · 0.85
bool_Method · 0.80

Tested by

no test coverage detected