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

Function test_ref_qualified_overload_cast

tests/test_methods_and_attributes.py:621–638  ·  view source on GitHub ↗

Test issue #2234 follow-up: overload_cast with ref-qualified member pointers. Covers: - overload_cast_impl::operator()(Return (Class::*)(Args...) &, false_type) - overload_cast_impl::operator()(Return (Class::*)(Args...) const &, true_type) - overload_cast_impl::operator()(Ret

()

Source from the content-addressed store, hash-verified

619
620
621def test_ref_qualified_overload_cast():
622 """Test issue #2234 follow-up: overload_cast with ref-qualified member pointers.
623
624 Covers:
625 - overload_cast_impl::operator()(Return (Class::*)(Args...) &, false_type)
626 - overload_cast_impl::operator()(Return (Class::*)(Args...) const &, true_type)
627 - overload_cast_impl::operator()(Return (Class::*)(Args...) &&, false_type)
628 - overload_cast_impl::operator()(Return (Class::*)(Args...) const &&, true_type)
629 - overload_cast_impl::operator()(Return (Class::*)(Args...) & noexcept, false_type)
630 - overload_cast_impl::operator()(Return (Class::*)(Args...) const & noexcept, true_type)
631 - overload_cast_impl::operator()(Return (Class::*)(Args...) && noexcept, false_type)
632 - overload_cast_impl::operator()(Return (Class::*)(Args...) const && noexcept, true_type)
633 """
634 obj = m.RefQualifiedOverloaded()
635 assert obj.method_lref(1) == "(int) &"
636 assert obj.method_const_lref(1) == "(int) const &"
637 assert obj.method_rref(1.0) == "(float) &&"
638 assert obj.method_const_rref(1.0) == "(float) const &&"
639
640
641@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 2

method_lrefMethod · 0.80
method_const_lrefMethod · 0.80

Tested by

no test coverage detected