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

Function test_str_issue

tests/test_methods_and_attributes.py:500–516  ·  view source on GitHub ↗

#283: __str__ called on uninitialized instance when constructor arguments invalid

(msg)

Source from the content-addressed store, hash-verified

498
499
500def test_str_issue(msg):
501 """#283: __str__ called on uninitialized instance when constructor arguments invalid"""
502
503 assert str(m.StrIssue(3)) == "StrIssue[3]"
504
505 with pytest.raises(TypeError) as excinfo:
506 str(m.StrIssue("no", "such", "constructor"))
507 assert (
508 msg(excinfo.value)
509 == """
510 __init__(): incompatible constructor arguments. The following argument types are supported:
511 1. m.methods_and_attributes.StrIssue(arg0: typing.SupportsInt | typing.SupportsIndex)
512 2. m.methods_and_attributes.StrIssue()
513
514 Invoked with: 'no', 'such', 'constructor'
515 """
516 )
517
518
519def test_unregistered_base_implementations():

Callers

nothing calls this directly

Calls 3

strClass · 0.85
msgFunction · 0.85
StrIssueMethod · 0.80

Tested by

no test coverage detected