Skip to content

Commit

Permalink
test hex support
Browse files Browse the repository at this point in the history
  • Loading branch information
InvincibleRMC committed Dec 12, 2024
1 parent 5c9b849 commit 96bee07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/test_pytypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace literals {
enum Color { RED = 0, BLUE = 1 };

typedef py::typing::Literal<26,
"0x1A",
0x1A,
"\"hello world\"",
"b\"hello world\"",
"u\"hello world\"",
Expand Down Expand Up @@ -985,7 +985,7 @@ TEST_SUBMODULE(pytypes, m) {

#if defined(PYBIND11_CPP17)
m.def("annotate_literal",
[](py::typing::Literal<3, 6, 1, 0, true, false> &o) -> py::object { return o; });
[](py::typing::Literal<3, 6, 1, 0, true, false, 0x14> &o) -> py::object { return o; });

m.attr("PYBIND11_CPP17") = true;
#else
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pytypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def test_optional_object_annotations(doc):
def test_literal(doc):
assert (
doc(m.annotate_literal)
== "annotate_literal(arg0: Literal[3, 6, 1, 0, True, False]) -> object"
== "annotate_literal(arg0: Literal[3, 6, 1, 0, True, False, 20]) -> object"
)


Expand All @@ -1053,7 +1053,7 @@ def test_literal(doc):
def test_complete_literal(doc):
assert (
doc(m.annotate_complete_literal)
== 'annotate_literal(arg0: Literal[26, 0x1A, "hello world", b"hello world", u"hello world", True, Color.RED, None]) -> object'
== 'annotate_literal(arg0: Literal[26, 20 "hello world", b"hello world", u"hello world", True, Color.RED, None]) -> object'
)


Expand Down

0 comments on commit 96bee07

Please sign in to comment.