diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-05-09 19:22:53 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-05-22 17:15:09 +0000 |
commit | 6914a229a038206341ae1fea46393965a555ca9a (patch) | |
tree | 4a11cfaed46dabc827c5ee17cd976f42b5f53d49 /ext/pybind11/tests/test_smart_ptr.py | |
parent | ca1d18d599dcc620bf526fb22042af95b1b60b68 (diff) | |
download | gem5-6914a229a038206341ae1fea46393965a555ca9a.tar.xz |
ext: Upgrade PyBind11 to version 2.1.1
Change-Id: I16870dec402d661295f9d013dc23e362b2b2c169
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/3225
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'ext/pybind11/tests/test_smart_ptr.py')
-rw-r--r-- | ext/pybind11/tests/test_smart_ptr.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/pybind11/tests/test_smart_ptr.py b/ext/pybind11/tests/test_smart_ptr.py index 3a33e1761..b5af3bd38 100644 --- a/ext/pybind11/tests/test_smart_ptr.py +++ b/ext/pybind11/tests/test_smart_ptr.py @@ -116,6 +116,11 @@ def test_smart_ptr(capture): assert cstats.move_assignments == 0 +def test_smart_ptr_refcounting(): + from pybind11_tests import test_object1_refcounting + assert test_object1_refcounting() + + def test_unique_nodelete(): from pybind11_tests import MyObject4 o = MyObject4(23) @@ -196,3 +201,22 @@ def test_shared_ptr_from_this_and_references(): del ref, bad_wp, copy, holder_ref, holder_copy, s assert stats.alive() == 0 + + +def test_move_only_holder(): + from pybind11_tests.smart_ptr import TypeWithMoveOnlyHolder + + a = TypeWithMoveOnlyHolder.make() + stats = ConstructorStats.get(TypeWithMoveOnlyHolder) + assert stats.alive() == 1 + del a + assert stats.alive() == 0 + + +def test_smart_ptr_from_default(): + from pybind11_tests.smart_ptr import HeldByDefaultHolder + + instance = HeldByDefaultHolder() + with pytest.raises(RuntimeError) as excinfo: + HeldByDefaultHolder.load_shared_ptr(instance) + assert "Unable to load a custom holder type from a default-holder instance" in str(excinfo) |