pytypes: Add Gotchas section about default-constructed wrapper types and py::none() (#2362)

This commit is contained in:
Eric Cousineau
2020-09-04 19:26:57 -04:00
committed by GitHub
parent 72b06b86b3
commit 44fa79ca80
3 changed files with 45 additions and 0 deletions

View File

@@ -326,6 +326,14 @@ def test_list_slicing():
assert li[::2] == m.test_list_slicing(li)
def test_issue2361():
# See issue #2361
assert m.issue2361_str_implicit_copy_none() == "None"
with pytest.raises(TypeError) as excinfo:
assert m.issue2361_dict_implicit_copy_none()
assert "'NoneType' object is not iterable" in str(excinfo.value)
@pytest.mark.parametrize('method, args, fmt, expected_view', [
(m.test_memoryview_object, (b'red',), 'B', b'red'),
(m.test_memoryview_buffer_info, (b'green',), 'B', b'green'),