Skip to content

[cppyy] Fix std::string return-type tests to match Pythonizations#22827

Merged
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:test_str
Jul 16, 2026
Merged

[cppyy] Fix std::string return-type tests to match Pythonizations#22827
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:test_str

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Un-xfail test18_operator_plus_overloads and
test34_cstring_template_argument, which check that C++ functions returning a std::string produce a string on the Python side.

These tests previously asserted the return type was exactly cppyy.gbl.std.string. That assumption is too strict: depending on which Pythonizations are enabled, a std::string returned from C++ may map to a different Python-side type. Compare instead against the type produced by a known std::string-returning function, std::to_string(42), so the tests verify consistent behavior rather than one specific type.

@guitargeek
guitargeek requested a review from siliataider July 16, 2026 06:21
@guitargeek guitargeek self-assigned this Jul 16, 2026
@guitargeek
guitargeek requested a review from aaronj0 as a code owner July 16, 2026 06:21
Un-xfail test18_operator_plus_overloads and
test34_cstring_template_argument, which check that C++ functions
returning a `std::string` produce a string on the Python side.

These tests previously asserted the return type was exactly
`cppyy.gbl.std.string`. That assumption is too strict: depending on
which Pythonizations are enabled, a `std::string` returned from C++ may
map to a different Python-side type. Compare instead against the type
produced by a known `std::string`-returning function,
`std::to_string(42)`, so the tests verify consistent behavior rather
than one specific type.

@siliataider siliataider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks!

@guitargeek
guitargeek merged commit a147670 into root-project:master Jul 16, 2026
30 of 31 checks passed
@guitargeek
guitargeek deleted the test_str branch July 16, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants