mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 08:32:02 +00:00
Test py::iterable/py::iterator representation in docstrings
This commit is contained in:
parent
4f1531c454
commit
ab323e04f3
@ -13,6 +13,10 @@
|
|||||||
TEST_SUBMODULE(pytypes, m) {
|
TEST_SUBMODULE(pytypes, m) {
|
||||||
// test_int
|
// test_int
|
||||||
m.def("get_int", []{return py::int_(0);});
|
m.def("get_int", []{return py::int_(0);});
|
||||||
|
// test_iterator
|
||||||
|
m.def("get_iterator", []{return py::iterator();});
|
||||||
|
// test_iterable
|
||||||
|
m.def("get_iterable", []{return py::iterable();});
|
||||||
// test_list
|
// test_list
|
||||||
m.def("get_list", []() {
|
m.def("get_list", []() {
|
||||||
py::list list;
|
py::list list;
|
||||||
|
@ -5,9 +5,19 @@ import sys
|
|||||||
from pybind11_tests import pytypes as m
|
from pybind11_tests import pytypes as m
|
||||||
from pybind11_tests import debug_enabled
|
from pybind11_tests import debug_enabled
|
||||||
|
|
||||||
|
|
||||||
def test_int(doc):
|
def test_int(doc):
|
||||||
assert doc(m.get_int) == "get_int() -> int"
|
assert doc(m.get_int) == "get_int() -> int"
|
||||||
|
|
||||||
|
|
||||||
|
def test_iterator(doc):
|
||||||
|
assert doc(m.get_iterator) == "get_iterator() -> Iterator"
|
||||||
|
|
||||||
|
|
||||||
|
def test_iterable(doc):
|
||||||
|
assert doc(m.get_iterable) == "get_iterable() -> Iterable"
|
||||||
|
|
||||||
|
|
||||||
def test_list(capture, doc):
|
def test_list(capture, doc):
|
||||||
with capture:
|
with capture:
|
||||||
lst = m.get_list()
|
lst = m.get_list()
|
||||||
|
Loading…
Reference in New Issue
Block a user