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

Function test_casts_none

tests/test_methods_and_attributes.py:489–497  ·  view source on GitHub ↗

#2778: implicit casting from None to object (not pointer)

()

Source from the content-addressed store, hash-verified

487
488
489def test_casts_none():
490 """#2778: implicit casting from None to object (not pointer)"""
491 a = m.NoneCastTester()
492 assert m.ok_obj_or_none(a) == -1
493 a = m.NoneCastTester(4)
494 assert m.ok_obj_or_none(a) == 4
495 a = m.NoneCastTester(None)
496 assert m.ok_obj_or_none(a) == -1
497 assert m.ok_obj_or_none(None) == -1
498
499
500def test_str_issue(msg):

Callers

nothing calls this directly

Calls 1

NoneCastTesterMethod · 0.80

Tested by

no test coverage detected