test_pytypes.py
Go to the documentation of this file.
1 import contextlib
2 import sys
3 import types
4 
5 import pytest
6 
7 import env
8 from pybind11_tests import detailed_error_messages_enabled
9 from pybind11_tests import pytypes as m
10 
11 
13  assert m.handle_from_move_only_type_with_operator_PyObject_ncnst()
14  assert m.handle_from_move_only_type_with_operator_PyObject_const()
15 
16 
17 def test_bool(doc):
18  assert doc(m.get_bool) == "get_bool() -> bool"
19 
20 
21 def test_int(doc):
22  assert doc(m.get_int) == "get_int() -> int"
23 
24 
25 def test_iterator(doc):
26  assert doc(m.get_iterator) == "get_iterator() -> Iterator"
27 
28 
29 def test_iterable(doc):
30  assert doc(m.get_iterable) == "get_iterable() -> Iterable"
31 
32 
33 def test_float(doc):
34  assert doc(m.get_float) == "get_float() -> float"
35 
36 
37 def test_list(capture, doc):
38  assert m.list_no_args() == []
39  assert m.list_ssize_t() == []
40  assert m.list_size_t() == []
41  lins = [1, 2]
42  m.list_insert_ssize_t(lins)
43  assert lins == [1, 83, 2]
44  m.list_insert_size_t(lins)
45  assert lins == [1, 83, 2, 57]
46 
47  with capture:
48  lst = m.get_list()
49  assert lst == ["inserted-0", "overwritten", "inserted-2"]
50 
51  lst.append("value2")
52  m.print_list(lst)
53  assert (
54  capture.unordered
55  == """
56  Entry at position 0: value
57  list item 0: inserted-0
58  list item 1: overwritten
59  list item 2: inserted-2
60  list item 3: value2
61  """
62  )
63 
64  assert doc(m.get_list) == "get_list() -> list"
65  assert doc(m.print_list) == "print_list(arg0: list) -> None"
66 
67 
68 def test_none(capture, doc):
69  assert doc(m.get_none) == "get_none() -> None"
70  assert doc(m.print_none) == "print_none(arg0: None) -> None"
71 
72 
73 def test_set(capture, doc):
74  s = m.get_set()
75  assert isinstance(s, set)
76  assert s == {"key1", "key2", "key3"}
77 
78  s.add("key4")
79  with capture:
80  m.print_anyset(s)
81  assert (
82  capture.unordered
83  == """
84  key: key1
85  key: key2
86  key: key3
87  key: key4
88  """
89  )
90 
91  m.set_add(s, "key5")
92  assert m.anyset_size(s) == 5
93 
94  m.set_clear(s)
95  assert m.anyset_empty(s)
96 
97  assert not m.anyset_contains(set(), 42)
98  assert m.anyset_contains({42}, 42)
99  assert m.anyset_contains({"foo"}, "foo")
100 
101  assert doc(m.get_set) == "get_set() -> set"
102  assert doc(m.print_anyset) == "print_anyset(arg0: anyset) -> None"
103 
104 
105 def test_frozenset(capture, doc):
106  s = m.get_frozenset()
107  assert isinstance(s, frozenset)
108  assert s == frozenset({"key1", "key2", "key3"})
109 
110  with capture:
111  m.print_anyset(s)
112  assert (
113  capture.unordered
114  == """
115  key: key1
116  key: key2
117  key: key3
118  """
119  )
120  assert m.anyset_size(s) == 3
121  assert not m.anyset_empty(s)
122 
123  assert not m.anyset_contains(frozenset(), 42)
124  assert m.anyset_contains(frozenset({42}), 42)
125  assert m.anyset_contains(frozenset({"foo"}), "foo")
126 
127  assert doc(m.get_frozenset) == "get_frozenset() -> frozenset"
128 
129 
130 def test_dict(capture, doc):
131  d = m.get_dict()
132  assert d == {"key": "value"}
133 
134  with capture:
135  d["key2"] = "value2"
136  m.print_dict(d)
137  assert (
138  capture.unordered
139  == """
140  key: key, value=value
141  key: key2, value=value2
142  """
143  )
144 
145  assert not m.dict_contains({}, 42)
146  assert m.dict_contains({42: None}, 42)
147  assert m.dict_contains({"foo": None}, "foo")
148 
149  assert doc(m.get_dict) == "get_dict() -> dict"
150  assert doc(m.print_dict) == "print_dict(arg0: dict) -> None"
151 
152  assert m.dict_keyword_constructor() == {"x": 1, "y": 2, "z": 3}
153 
154 
156  assert m.tuple_no_args() == ()
157  assert m.tuple_ssize_t() == ()
158  assert m.tuple_size_t() == ()
159  assert m.get_tuple() == (42, None, "spam")
160 
161 
163  ns = m.get_simple_namespace()
164  assert ns.attr == 42
165  assert ns.x == "foo"
166  assert ns.right == 2
167  assert not hasattr(ns, "wrong")
168 
169 
170 def test_str(doc):
171  assert m.str_from_char_ssize_t().encode().decode() == "red"
172  assert m.str_from_char_size_t().encode().decode() == "blue"
173  assert m.str_from_string().encode().decode() == "baz"
174  assert m.str_from_bytes().encode().decode() == "boo"
175 
176  assert doc(m.str_from_bytes) == "str_from_bytes() -> str"
177 
178  class A:
179  def __str__(self):
180  return "this is a str"
181 
182  def __repr__(self):
183  return "this is a repr"
184 
185  assert m.str_from_object(A()) == "this is a str"
186  assert m.repr_from_object(A()) == "this is a repr"
187  assert m.str_from_handle(A()) == "this is a str"
188 
189  s1, s2 = m.str_format()
190  assert s1 == "1 + 2 = 3"
191  assert s1 == s2
192 
193  malformed_utf8 = b"\x80"
194  if hasattr(m, "PYBIND11_STR_LEGACY_PERMISSIVE"):
195  assert m.str_from_object(malformed_utf8) is malformed_utf8
196  else:
197  assert m.str_from_object(malformed_utf8) == "b'\\x80'"
198  assert m.str_from_handle(malformed_utf8) == "b'\\x80'"
199 
200  assert m.str_from_string_from_str("this is a str") == "this is a str"
201  ucs_surrogates_str = "\udcc3"
202  with pytest.raises(UnicodeEncodeError):
203  m.str_from_string_from_str(ucs_surrogates_str)
204 
205 
206 def test_bytes(doc):
207  assert m.bytes_from_char_ssize_t().decode() == "green"
208  assert m.bytes_from_char_size_t().decode() == "purple"
209  assert m.bytes_from_string().decode() == "foo"
210  assert m.bytes_from_str().decode() == "bar"
211 
212  assert doc(m.bytes_from_str) == "bytes_from_str() -> bytes"
213 
214 
215 def test_bytearray(doc):
216  assert m.bytearray_from_char_ssize_t().decode() == "$%"
217  assert m.bytearray_from_char_size_t().decode() == "@$!"
218  assert m.bytearray_from_string().decode() == "foo"
219  assert m.bytearray_size() == len("foo")
220 
221 
222 def test_capsule(capture):
223  pytest.gc_collect()
224  with capture:
225  a = m.return_capsule_with_destructor()
226  del a
227  pytest.gc_collect()
228  assert (
229  capture.unordered
230  == """
231  creating capsule
232  destructing capsule
233  """
234  )
235 
236  with capture:
237  a = m.return_renamed_capsule_with_destructor()
238  del a
239  pytest.gc_collect()
240  assert (
241  capture.unordered
242  == """
243  creating capsule
244  renaming capsule
245  destructing capsule
246  """
247  )
248 
249  with capture:
250  a = m.return_capsule_with_destructor_2()
251  del a
252  pytest.gc_collect()
253  assert (
254  capture.unordered
255  == """
256  creating capsule
257  destructing capsule: 1234
258  """
259  )
260 
261  with capture:
262  a = m.return_renamed_capsule_with_destructor_2()
263  del a
264  pytest.gc_collect()
265  assert (
266  capture.unordered
267  == """
268  creating capsule
269  renaming capsule
270  destructing capsule: 1234
271  """
272  )
273 
274  with capture:
275  a = m.return_capsule_with_name_and_destructor()
276  del a
277  pytest.gc_collect()
278  assert (
279  capture.unordered
280  == """
281  created capsule (1234, 'pointer type description')
282  destructing capsule (1234, 'pointer type description')
283  """
284  )
285 
286 
288  class SubTestObject:
289  attr_obj = 1
290  attr_char = 2
291 
292  class TestObject:
293  basic_attr = 1
294  begin_end = [1, 2, 3]
295  d = {"operator[object]": 1, "operator[char *]": 2}
296  sub = SubTestObject()
297 
298  def func(self, x, *args):
299  return self.basic_attr + x + sum(args)
300 
301  d = m.accessor_api(TestObject())
302  assert d["basic_attr"] == 1
303  assert d["begin_end"] == [1, 2, 3]
304  assert d["operator[object]"] == 1
305  assert d["operator[char *]"] == 2
306  assert d["attr(object)"] == 1
307  assert d["attr(char *)"] == 2
308  assert d["missing_attr_ptr"] == "raised"
309  assert d["missing_attr_chain"] == "raised"
310  assert d["is_none"] is False
311  assert d["operator()"] == 2
312  assert d["operator*"] == 7
313  assert d["implicit_list"] == [1, 2, 3]
314  assert all(x in TestObject.__dict__ for x in d["implicit_dict"])
315 
316  assert m.tuple_accessor(tuple()) == (0, 1, 2)
317 
318  d = m.accessor_assignment()
319  assert d["get"] == 0
320  assert d["deferred_get"] == 0
321  assert d["set"] == 1
322  assert d["deferred_set"] == 1
323  assert d["var"] == 99
324 
325 
327  inc_refs = m.accessor_moves()
328  if inc_refs:
329  assert inc_refs == [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
330  else:
331  pytest.skip("Not defined: PYBIND11_HANDLE_REF_DEBUG")
332 
333 
335  """C++ default and converting constructors are equivalent to type calls in Python"""
336  types = [bytes, bytearray, str, bool, int, float, tuple, list, dict, set]
337  expected = {t.__name__: t() for t in types}
338  assert m.default_constructors() == expected
339 
340  data = {
341  bytes: b"41", # Currently no supported or working conversions.
342  bytearray: bytearray(b"41"),
343  str: 42,
344  bool: "Not empty",
345  int: "42",
346  float: "+1e3",
347  tuple: range(3),
348  list: range(3),
349  dict: [("two", 2), ("one", 1), ("three", 3)],
350  set: [4, 4, 5, 6, 6, 6],
351  frozenset: [4, 4, 5, 6, 6, 6],
352  memoryview: b"abc",
353  }
354  inputs = {k.__name__: v for k, v in data.items()}
355  expected = {k.__name__: k(v) for k, v in data.items()}
356 
357  assert m.converting_constructors(inputs) == expected
358  assert m.cast_functions(inputs) == expected
359 
360  # Converting constructors and cast functions should just reference rather
361  # than copy when no conversion is needed:
362  noconv1 = m.converting_constructors(expected)
363  for k in noconv1:
364  assert noconv1[k] is expected[k]
365 
366  noconv2 = m.cast_functions(expected)
367  for k in noconv2:
368  assert noconv2[k] is expected[k]
369 
370 
372  non_converting_test_cases = [
373  ("bytes", range(10)),
374  ("none", 42),
375  ("ellipsis", 42),
376  ("type", 42),
377  ]
378  for t, v in non_converting_test_cases:
379  for move in [True, False]:
380  with pytest.raises(TypeError) as excinfo:
381  m.nonconverting_constructor(t, v, move)
382  expected_error = (
383  f"Object of type '{type(v).__name__}' is not an instance of '{t}'"
384  )
385  assert str(excinfo.value) == expected_error
386 
387 
389  # specifically to exercise pybind11::str::raw_str
390  cvt = m.convert_to_pybind11_str
391  assert cvt("Str") == "Str"
392  assert cvt(b"Bytes") == "b'Bytes'"
393  assert cvt(None) == "None"
394  assert cvt(False) == "False"
395  assert cvt(True) == "True"
396  assert cvt(42) == "42"
397  assert cvt(2**65) == "36893488147419103232"
398  assert cvt(-1.50) == "-1.5"
399  assert cvt(()) == "()"
400  assert cvt((18,)) == "(18,)"
401  assert cvt([]) == "[]"
402  assert cvt([28]) == "[28]"
403  assert cvt({}) == "{}"
404  assert cvt({3: 4}) == "{3: 4}"
405  assert cvt(set()) == "set()"
406  assert cvt({3, 3}) == "{3}"
407 
408  valid_orig = "DZ"
409  valid_utf8 = valid_orig.encode("utf-8")
410  valid_cvt = cvt(valid_utf8)
411  if hasattr(m, "PYBIND11_STR_LEGACY_PERMISSIVE"):
412  assert valid_cvt is valid_utf8
413  else:
414  assert type(valid_cvt) is str
415  assert valid_cvt == "b'\\xc7\\xb1'"
416 
417  malformed_utf8 = b"\x80"
418  if hasattr(m, "PYBIND11_STR_LEGACY_PERMISSIVE"):
419  assert cvt(malformed_utf8) is malformed_utf8
420  else:
421  malformed_cvt = cvt(malformed_utf8)
422  assert type(malformed_cvt) is str
423  assert malformed_cvt == "b'\\x80'"
424 
425 
427  """Tests implicit casting when assigning or appending to dicts and lists."""
428  z = m.get_implicit_casting()
429  assert z["d"] == {
430  "char*_i1": "abc",
431  "char*_i2": "abc",
432  "char*_e": "abc",
433  "char*_p": "abc",
434  "str_i1": "str",
435  "str_i2": "str1",
436  "str_e": "str2",
437  "str_p": "str3",
438  "int_i1": 42,
439  "int_i2": 42,
440  "int_e": 43,
441  "int_p": 44,
442  }
443  assert z["l"] == [3, 6, 9, 12, 15]
444 
445 
446 def test_print(capture):
447  with capture:
448  m.print_function()
449  assert (
450  capture
451  == """
452  Hello, World!
453  1 2.0 three True -- multiple args
454  *args-and-a-custom-separator
455  no new line here -- next print
456  flush
457  py::print + str.format = this
458  """
459  )
460  assert capture.stderr == "this goes to stderr"
461 
462  with pytest.raises(RuntimeError) as excinfo:
463  m.print_failure()
464  assert str(excinfo.value) == "Unable to convert call argument " + (
465  "'1' of type 'UnregisteredType' to Python object"
466  if detailed_error_messages_enabled
467  else "to Python object (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)"
468  )
469 
470 
471 def test_hash():
472  class Hashable:
473  def __init__(self, value):
474  self.value = value
475 
476  def __hash__(self):
477  return self.value
478 
479  class Unhashable:
480  __hash__ = None
481 
482  assert m.hash_function(Hashable(42)) == 42
483  with pytest.raises(TypeError):
484  m.hash_function(Unhashable())
485 
486 
488  for a, b in [(1, 1), (3, 5)]:
489  li = [
490  a == b,
491  a != b,
492  a < b,
493  a <= b,
494  a > b,
495  a >= b,
496  a + b,
497  a - b,
498  a * b,
499  a / b,
500  a | b,
501  a & b,
502  a ^ b,
503  a >> b,
504  a << b,
505  ]
506  assert m.test_number_protocol(a, b) == li
507 
508 
510  li = list(range(100))
511  assert li[::2] == m.test_list_slicing(li)
512 
513 
515  # See issue #2361
516  assert m.issue2361_str_implicit_copy_none() == "None"
517  with pytest.raises(TypeError) as excinfo:
518  assert m.issue2361_dict_implicit_copy_none()
519  assert "NoneType" in str(excinfo.value)
520  assert "iterable" in str(excinfo.value)
521 
522 
523 @pytest.mark.parametrize(
524  "method, args, fmt, expected_view",
525  [
526  (m.test_memoryview_object, (b"red",), "B", b"red"),
527  (m.test_memoryview_buffer_info, (b"green",), "B", b"green"),
528  (m.test_memoryview_from_buffer, (False,), "h", [3, 1, 4, 1, 5]),
529  (m.test_memoryview_from_buffer, (True,), "H", [2, 7, 1, 8]),
530  (m.test_memoryview_from_buffer_nativeformat, (), "@i", [4, 7, 5]),
531  ],
532 )
533 def test_memoryview(method, args, fmt, expected_view):
534  view = method(*args)
535  assert isinstance(view, memoryview)
536  assert view.format == fmt
537  assert list(view) == list(expected_view)
538 
539 
540 @pytest.mark.xfail("env.PYPY", reason="getrefcount is not available")
541 @pytest.mark.parametrize(
542  "method",
543  [
544  m.test_memoryview_object,
545  m.test_memoryview_buffer_info,
546  ],
547 )
549  buf = b"\x0a\x0b\x0c\x0d"
550  ref_before = sys.getrefcount(buf)
551  view = method(buf)
552  ref_after = sys.getrefcount(buf)
553  assert ref_before < ref_after
554  assert list(view) == list(buf)
555 
556 
558  view = m.test_memoryview_from_buffer_empty_shape()
559  assert isinstance(view, memoryview)
560  assert view.format == "B"
561  assert bytes(view) == b""
562 
563 
565  with pytest.raises(RuntimeError):
566  m.test_memoryview_from_buffer_invalid_strides()
567 
568 
570  with pytest.raises(ValueError):
571  m.test_memoryview_from_buffer_nullptr()
572 
573 
575  view = m.test_memoryview_from_memory()
576  assert isinstance(view, memoryview)
577  assert view.format == "B"
578  assert bytes(view) == b"\xff\xe1\xab\x37"
579 
580 
582  assert m.get_len([i for i in range(42)]) == 42
583  with pytest.raises(TypeError) as exc_info:
584  m.get_len(i for i in range(42))
585  assert str(exc_info.value) in [
586  "object of type 'generator' has no len()",
587  "'generator' has no length",
588  ] # PyPy
589 
590 
592  assert m.isinstance_pybind11_bytes(b"")
593  assert not m.isinstance_pybind11_bytes("")
594 
595  assert m.isinstance_pybind11_str("")
596  if hasattr(m, "PYBIND11_STR_LEGACY_PERMISSIVE"):
597  assert m.isinstance_pybind11_str(b"")
598  else:
599  assert not m.isinstance_pybind11_str(b"")
600 
601 
603  assert m.pass_to_pybind11_bytes(b"Bytes") == 5
604  with pytest.raises(TypeError):
605  m.pass_to_pybind11_bytes("Str")
606 
607  if hasattr(m, "PYBIND11_STR_LEGACY_PERMISSIVE"):
608  assert m.pass_to_pybind11_str(b"Bytes") == 5
609  else:
610  with pytest.raises(TypeError):
611  m.pass_to_pybind11_str(b"Bytes")
612  assert m.pass_to_pybind11_str("Str") == 3
613 
614  assert m.pass_to_std_string(b"Bytes") == 5
615  assert m.pass_to_std_string("Str") == 3
616 
617  malformed_utf8 = b"\x80"
618  if hasattr(m, "PYBIND11_STR_LEGACY_PERMISSIVE"):
619  assert m.pass_to_pybind11_str(malformed_utf8) == 1
620  else:
621  with pytest.raises(TypeError):
622  m.pass_to_pybind11_str(malformed_utf8)
623 
624 
625 @pytest.mark.parametrize(
626  "create_weakref, create_weakref_with_callback",
627  [
628  (m.weakref_from_handle, m.weakref_from_handle_and_function),
629  (m.weakref_from_object, m.weakref_from_object_and_function),
630  ],
631 )
632 def test_weakref(create_weakref, create_weakref_with_callback):
633  from weakref import getweakrefcount
634 
635  # Apparently, you cannot weakly reference an object()
636  class WeaklyReferenced:
637  pass
638 
639  callback_called = False
640 
641  def callback(wr):
642  nonlocal callback_called
643  callback_called = True
644 
645  obj = WeaklyReferenced()
646  assert getweakrefcount(obj) == 0
647  wr = create_weakref(obj)
648  assert getweakrefcount(obj) == 1
649 
650  obj = WeaklyReferenced()
651  assert getweakrefcount(obj) == 0
652  wr = create_weakref_with_callback(obj, callback) # noqa: F841
653  assert getweakrefcount(obj) == 1
654  assert not callback_called
655  del obj
656  pytest.gc_collect()
657  assert callback_called
658 
659 
660 @pytest.mark.parametrize(
661  "create_weakref, has_callback",
662  [
663  (m.weakref_from_handle, False),
664  (m.weakref_from_object, False),
665  (m.weakref_from_handle_and_function, True),
666  (m.weakref_from_object_and_function, True),
667  ],
668 )
669 def test_weakref_err(create_weakref, has_callback):
670  class C:
671  __slots__ = []
672 
673  def callback(_):
674  pass
675 
676  ob = C()
677  # Should raise TypeError on CPython
678  with pytest.raises(TypeError) if not env.PYPY else contextlib.nullcontext():
679  if has_callback:
680  _ = create_weakref(ob, callback)
681  else:
682  _ = create_weakref(ob)
683 
684 
686  assert m.tuple_iterator() == 12
687  assert m.dict_iterator() == 305 + 711
688  assert m.passed_iterator(iter((-7, 3))) == -4
689 
690 
692  lst = [39, 43, 92, 49, 22, 29, 93, 98, 26, 57, 8]
693  tup = tuple(lst)
694  assert m.sequence_item_get_ssize_t(lst) == 43
695  assert m.sequence_item_set_ssize_t(lst) is None
696  assert lst[1] == "peppa"
697  assert m.sequence_item_get_size_t(lst) == 92
698  assert m.sequence_item_set_size_t(lst) is None
699  assert lst[2] == "george"
700  assert m.list_item_get_ssize_t(lst) == 49
701  assert m.list_item_set_ssize_t(lst) is None
702  assert lst[3] == "rebecca"
703  assert m.list_item_get_size_t(lst) == 22
704  assert m.list_item_set_size_t(lst) is None
705  assert lst[4] == "richard"
706  assert m.tuple_item_get_ssize_t(tup) == 29
707  assert m.tuple_item_set_ssize_t() == ("emely", "edmond")
708  assert m.tuple_item_get_size_t(tup) == 93
709  assert m.tuple_item_set_size_t() == ("candy", "cat")
710 
711 
713  r1 = m.square_float_(2.0)
714  assert r1 == 4.0
715 
716 
718  pop = 1000
719  tup = tuple(range(pop))
720  m.tuple_rvalue_getter(tup)
721 
722 
724  pop = 1000
725  my_list = list(range(pop))
726  m.list_rvalue_getter(my_list)
727 
728 
730  pop = 1000
731  my_dict = {i: i for i in range(pop)}
732  assert m.populate_dict_rvalue(pop) == my_dict
733 
734 
736  pop = 1000
737  o = types.SimpleNamespace(**{str(i): i for i in range(pop)})
738  new_o = m.populate_obj_str_attrs(o, pop)
739  new_attrs = {k: v for k, v in new_o.__dict__.items() if not k.startswith("_")}
740  assert all(isinstance(v, str) for v in new_attrs.values())
741  assert len(new_attrs) == pop
bool hasattr(handle obj, handle name)
Definition: pytypes.h:728
static const Eigen::internal::all_t all
def test_number_protocol()
def test_capsule(capture)
def test_memoryview_refcount(method)
def test_builtin_functions()
Annotation for documentation.
Definition: attr.h:42
def test_dict(capture, doc)
def test_tuple()
def test_iterator(doc)
Definition: test_pytypes.py:25
def test_print(capture)
def test_none(capture, doc)
Definition: test_pytypes.py:68
def test_pybind11_str_raw_str()
def test_bool(doc)
Definition: test_pytypes.py:17
iterator iter(handle obj)
Definition: pytypes.h:2273
bool isinstance(handle obj)
Definition: pytypes.h:700
def test_populate_obj_str_attrs()
def test_frozenset(capture, doc)
def test_implementation_details()
def test_test_memoryview_from_buffer_invalid_strides()
def test_test_memoryview_from_buffer_nullptr()
def test_constructors()
def test_pass_bytes_or_unicode_to_string_types()
def test_bytearray(doc)
def test_external_float_()
def test_list(capture, doc)
Definition: test_pytypes.py:37
def test_set(capture, doc)
Definition: test_pytypes.py:73
def test_int(doc)
Definition: test_pytypes.py:21
def test_memoryview_from_memory()
def test_accessor_moves()
Definition: pytypes.h:1403
def test_accessors()
def test_bytes(doc)
def test_list_rvalue_getter()
def test_handle_from_move_only_type_with_operator_PyObject()
Definition: test_pytypes.py:12
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
def test_tuple_rvalue_getter()
Definition: pytypes.h:1979
def test_cpp_iterators()
def test_weakref(create_weakref, create_weakref_with_callback)
int func(const int &a)
Definition: testDSF.cpp:221
def test_non_converting_constructors()
Double_ range(const Point2_ &p, const Point2_ &q)
def test_memoryview_from_buffer_empty_shape()
def test_issue2361()
def test_weakref_err(create_weakref, has_callback)
IndexPair decode(Index ij)
int encode(Index i, Index j)
def test_implicit_casting()
def test_str(doc)
def test_isinstance_string_types()
def test_iterable(doc)
Definition: test_pytypes.py:29
def test_memoryview(method, args, fmt, expected_view)
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2244
def test_list_slicing()
def test_simple_namespace()
Definition: pytypes.h:2030
def test_populate_dict_rvalue()
def test_float(doc)
Definition: test_pytypes.py:33
Point2 t(10, 10)
Definition: pytypes.h:1370


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:37:46