mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-28 22:02:43 +00:00
style: pre-commit fixes
This commit is contained in:
parent
b296137950
commit
981e0a3c83
@ -1058,9 +1058,8 @@ TEST_SUBMODULE(pytypes, m) {
|
|||||||
instance.def(py::init());
|
instance.def(py::init());
|
||||||
instance.attr_with_type_hint<float>("y");
|
instance.attr_with_type_hint<float>("y");
|
||||||
|
|
||||||
m.def("attr_with_type_hint_float_x", [](py::handle obj) {
|
m.def("attr_with_type_hint_float_x",
|
||||||
obj.attr_with_type_hint<float>("x");
|
[](py::handle obj) { obj.attr_with_type_hint<float>("x"); });
|
||||||
});
|
|
||||||
|
|
||||||
m.attr_with_type_hint<py::typing::Final<int>>("CONST_INT") = 3;
|
m.attr_with_type_hint<py::typing::Final<int>>("CONST_INT") = 3;
|
||||||
|
|
||||||
|
@ -1162,9 +1162,12 @@ def test_redeclaration_attr_with_type_hint() -> None:
|
|||||||
m.attr_with_type_hint_float_x(obj)
|
m.attr_with_type_hint_float_x(obj)
|
||||||
help(obj)
|
help(obj)
|
||||||
assert get_annotations_helper(obj)["x"] == "float"
|
assert get_annotations_helper(obj)["x"] == "float"
|
||||||
with pytest.raises(RuntimeError, match=r'^__annotations__\["x"\] was set already\.$'):
|
with pytest.raises(
|
||||||
|
RuntimeError, match=r'^__annotations__\["x"\] was set already\.$'
|
||||||
|
):
|
||||||
m.attr_with_type_hint_float_x(obj)
|
m.attr_with_type_hint_float_x(obj)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
not m.defined___cpp_inline_variables,
|
not m.defined___cpp_inline_variables,
|
||||||
reason="C++17 feature __cpp_inline_variables not available.",
|
reason="C++17 feature __cpp_inline_variables not available.",
|
||||||
|
Loading…
Reference in New Issue
Block a user