Skip to content

Commit

Permalink
test instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
InvincibleRMC committed Dec 12, 2024
1 parent 97c0414 commit c7a4ea4
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/test_pytypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ enum Color { RED = 0, BLUE = 1 };

typedef py::typing::Literal<26,
0x1A,
"\"hello world\"",
"b\"hello world\"",
"u\"hello world\"",
py::typing::StringLiteral("\"hello world\""),
py::typing::StringLiteral("b\"hello world\""),
py::typing::StringLiteral("u\"hello world\""),
true,
"Color.RED",
"None">
py::typing::StringLiteral("Color.RED"),
py::typing::StringLiteral("None")>
LiteralFoo;
} // namespace literals
namespace typevar {
typedef py::typing::TypeVar<"T"> TypeVarT;
typedef py::typing::TypeVar<"V"> TypeVarV;
typedef py::typing::TypeVar<py::typing::StringLiteral("V")> TypeVarV;
} // namespace typevar
#endif

Expand Down Expand Up @@ -971,11 +971,9 @@ TEST_SUBMODULE(pytypes, m) {

m.def("annotate_complete_literal", [](literals::LiteralFoo &o) -> py::object { return o; });

m.def("literal_test", [](py::typing::Literal<"hi"> &o) -> py::object { return o; })

m.def("annotate_generic_containers",
[](const py::typing::List<typevar::TypeVarT> &l)
-> py::typing::List<typevar::TypeVarV> { return l; });
m.def("annotate_generic_containers",
[](const py::typing::List<typevar::TypeVarT> &l)
-> py::typing::List<typevar::TypeVarV> { return l; });

m.def("annotate_listT_to_T",
[](const py::typing::List<typevar::TypeVarT> &l) -> typevar::TypeVarT { return l[0]; });
Expand Down

0 comments on commit c7a4ea4

Please sign in to comment.