Skip to content

test_builtin_casters.py test_string_view: Python 2 c++17, c++2a compa… - #2314

Merged
rwgk merged 1 commit into
pybind:masterfrom
rwgk:py2_cxx17_fix
Jul 22, 2020
Merged

test_builtin_casters.py test_string_view: Python 2 c++17, c++2a compa…#2314
rwgk merged 1 commit into
pybind:masterfrom
rwgk:py2_cxx17_fix

Conversation

@rwgk

@rwgkrwgk commented Jul 22, 2020

Copy link
Copy Markdown
Collaborator

…tibility.

Tested with 2.7.18rc1, built with Py_UNICODE_SIZE 4.
Change also tested with Python 3.8.

…tibility.
Tested with 2.7.18rc1, built with Py_UNICODE_SIZE 4.
Change also tested with Python 3.8.

@YannickJadoulYannickJadoul left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same is done here:

assertm.ord_char16(u'a') ==0x61
assertm.ord_char16(u'é') ==0xE9
assertm.ord_char16_lv(u'ê') ==0xEA
assertm.ord_char16(u'Ā') ==0x100
assertm.ord_char16(u'‽') ==0x203d
assertm.ord_char16(u'♥') ==0x2665
assertm.ord_char16_lv(u'♡') ==0x2661
withpytest.raises(ValueError) asexcinfo:
assertm.ord_char16(u'🎂') ==0x1F382# requires surrogate pair
assertstr(excinfo.value) ==toobig_message(0x10000)
withpytest.raises(ValueError) asexcinfo:
assertm.ord_char16(u'aa')
assertstr(excinfo.value) ==toolong_message
assertm.ord_char32(u'a') ==0x61
assertm.ord_char32(u'é') ==0xE9
assertm.ord_char32(u'Ā') ==0x100
assertm.ord_char32(u'‽') ==0x203d
assertm.ord_char32(u'♥') ==0x2665
assertm.ord_char32(u'🎂') ==0x1F382
withpytest.raises(ValueError) asexcinfo:
assertm.ord_char32(u'aa')
assertstr(excinfo.value) ==toolong_message

So seems great to me! :-)

@rwgk

rwgk commented Jul 22, 2020

Copy link
Copy Markdown
CollaboratorAuthor

Thanks a lot Yannick for pointing out the other test using the same approach, I missed that. Since there is a precedence for what I'm doing I'll merge this PR now, to get a baseline for my work on PR #2256.

@rwgk
rwgk merged commit 96c6763 into pybind:masterJul 22, 2020
@rwgk
rwgk deleted the py2_cxx17_fix branch July 22, 2020 19:05
@rwgkrwgk mentioned this pull request Feb 10, 2023
Sign up for freeto 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

@rwgk@YannickJadoul