test_unique_ptr_member.py 424 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: utf-8 -*-
import pytest

from pybind11_tests import unique_ptr_member as m


def test_cpp_pattern():
    res = m.cpp_pattern()
    assert res == 10


def test_pointee_and_ptr_owner():
    obj = m.pointee()
    assert obj.get_int() == 213
    m.ptr_owner(obj)
    with pytest.raises(ValueError) as exc_info:
        obj.get_int()
    assert str(exc_info.value).startswith("Missing value for wrapped C++ type ")