MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_path_typing

Function test_path_typing

tests/test_stl.py:308–338  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

306
307@pytest.mark.skipif(not hasattr(m, "has_filesystem"), reason="no <filesystem>")
308def test_path_typing(doc):
309 # Single argument
310 assert (
311 doc(m.parent_path)
312 == "parent_path(arg0: os.PathLike | str | bytes) -> pathlib.Path"
313 )
314 # std::vector
315 assert (
316 doc(m.parent_paths)
317 == "parent_paths(arg0: collections.abc.Sequence[os.PathLike | str | bytes]) -> list[pathlib.Path]"
318 )
319 # py::typing::List
320 assert (
321 doc(m.parent_paths_list)
322 == "parent_paths_list(arg0: list[os.PathLike | str | bytes]) -> list[pathlib.Path]"
323 )
324 # Nested py::typing::List
325 assert (
326 doc(m.parent_paths_nested_list)
327 == "parent_paths_nested_list(arg0: list[list[os.PathLike | str | bytes]]) -> list[list[pathlib.Path]]"
328 )
329 # py::typing::Tuple
330 assert (
331 doc(m.parent_paths_tuple)
332 == "parent_paths_tuple(arg0: tuple[os.PathLike | str | bytes, os.PathLike | str | bytes]) -> tuple[pathlib.Path, pathlib.Path]"
333 )
334 # py::typing::Dict
335 assert (
336 doc(m.parent_paths_dict)
337 == "parent_paths_dict(arg0: dict[str, os.PathLike | str | bytes]) -> dict[str, pathlib.Path]"
338 )
339
340
341@pytest.mark.skipif(not hasattr(m, "load_variant"), reason="no <variant>")

Callers

nothing calls this directly

Calls 1

docFunction · 0.70

Tested by

no test coverage detected