Skip to content

Commit

Permalink
Added test for -> with io_name
Browse files Browse the repository at this point in the history
  • Loading branch information
timohl committed Jan 10, 2025
1 parent 9bb4f20 commit e97433c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/test_pytypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<RealNumber(const py::typing::Literal<"\"->\""> &,
const RealNumber &)> &x) { return x; });
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pytypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e97433c

Please sign in to comment.