From e97433c2b2cb36e6d75779804db439da4330863d Mon Sep 17 00:00:00 2001 From: Tim Ohliger Date: Fri, 10 Jan 2025 09:46:38 +0100 Subject: [PATCH] Added test for `->` with io_name --- tests/test_pytypes.cpp | 3 ++- tests/test_pytypes.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_pytypes.cpp b/tests/test_pytypes.cpp index e1e3347181..43a0247208 100644 --- a/tests/test_pytypes.cpp +++ b/tests/test_pytypes.cpp @@ -977,7 +977,8 @@ TEST_SUBMODULE(pytypes, m) { m.def("identity_literal_percent", [](const py::typing::Literal<"\"%\""> &x) { return x; }); m.def("identity_literal_curly_open", [](const py::typing::Literal<"\"{\""> &x) { return x; }); m.def("identity_literal_curly_close", [](const py::typing::Literal<"\"}\""> &x) { return x; }); - m.def("identity_literal_arrow", [](const py::typing::Literal<"\"->\""> &x) { return x; }); + m.def("identity_literal_arrow_with_io_name", + [](const py::typing::Literal<"\"->\""> &x, const RealNumber &y) { return x; }); m.def("identity_literal_arrow_with_callable", [](const py::typing::Callable\""> &, const RealNumber &)> &x) { return x; }); diff --git a/tests/test_pytypes.py b/tests/test_pytypes.py index a6f3ca6585..9edc6ea5ec 100644 --- a/tests/test_pytypes.py +++ b/tests/test_pytypes.py @@ -1066,8 +1066,8 @@ def test_literal(doc): == 'identity_literal_curly_close(arg0: Literal["}"]) -> Literal["}"]' ) assert ( - doc(m.identity_literal_arrow) - == 'identity_literal_arrow(arg0: Literal["->"]) -> Literal["->"]' + doc(m.identity_literal_arrow_with_io_name) + == 'identity_literal_arrow_with_io_name(arg0: Literal["->"], arg1: Union[float, int]) -> Literal["->"]' ) assert ( doc(m.identity_literal_arrow_with_callable)