aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_opaque_types.py
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/pybind11/tests/test_opaque_types.py')
-rw-r--r--3rdparty/pybind11/tests/test_opaque_types.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/3rdparty/pybind11/tests/test_opaque_types.py b/3rdparty/pybind11/tests/test_opaque_types.py
index 6b3802fd..77379463 100644
--- a/3rdparty/pybind11/tests/test_opaque_types.py
+++ b/3rdparty/pybind11/tests/test_opaque_types.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import pytest
from pybind11_tests import opaque_types as m
from pybind11_tests import ConstructorStats, UserType
@@ -31,12 +32,15 @@ def test_pointers(msg):
with pytest.raises(TypeError) as excinfo:
m.get_void_ptr_value([1, 2, 3]) # This should not work
- assert msg(excinfo.value) == """
+ assert (
+ msg(excinfo.value)
+ == """
get_void_ptr_value(): incompatible function arguments. The following argument types are supported:
1. (arg0: capsule) -> int
Invoked with: [1, 2, 3]
""" # noqa: E501 line too long
+ )
assert m.return_null_str() is None
assert m.get_null_str_value(m.return_null_str()) is not None
@@ -44,3 +48,11 @@ def test_pointers(msg):
ptr = m.return_unique_ptr()
assert "StringList" in repr(ptr)
assert m.print_opaque_list(ptr) == "Opaque list: [some value]"
+
+
+def test_unions():
+ int_float_union = m.IntFloat()
+ int_float_union.i = 42
+ assert int_float_union.i == 42
+ int_float_union.f = 3.0
+ assert int_float_union.f == 3.0