Skip to content

Commit 72d95a6

Browse files
committed
adding test: pass_to_pybind11_unicode(malformed_utf8)
1 parent 74f0ce4 commit 72d95a6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_pytypes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,8 @@ def test_pass_actual_bytes_or_unicode_to_string_types():
396396

397397
assert m.pass_to_std_string(actual_bytes) == 5
398398
assert m.pass_to_std_string(actual_unicode) == 3
399+
400+
malformed_utf8 = b"\x80"
401+
with pytest.raises(UnicodeDecodeError) as excinfo:
402+
m.pass_to_pybind11_unicode(malformed_utf8)
403+
assert 'invalid start byte' in str(excinfo.value)

0 commit comments

Comments
 (0)