mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
Added test case
This commit is contained in:
parent
14cde218ef
commit
82906b97c1
@ -322,4 +322,16 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
|
||||
py::pos_only{},
|
||||
py::arg("i"),
|
||||
py::arg("j"));
|
||||
|
||||
// Test support for args and kwargs subclasses
|
||||
class ArgsSubclass: public py::args{
|
||||
using py::args::args;
|
||||
}
|
||||
class KWArgsSubclass: public py::kwargs{
|
||||
using py::kwargs::kwargs;
|
||||
}
|
||||
m.def("args_kwargs_subclass_function", [](const ArgsSubclass &args, const KWArgsSubclass &kwargs) {
|
||||
return py::make_tuple(args, kwargs);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -426,3 +426,8 @@ def test_args_refcount():
|
||||
assert m.mixed_args_refcount(myval, myval, myval) == (exp3_3, exp3_3, exp3_3)
|
||||
|
||||
assert m.class_default_argument() == "<class 'decimal.Decimal'>"
|
||||
|
||||
assert m.args_kwargs_subclass_function(7, 8, myval, a=1, b=myval) == (
|
||||
(7, 8, myval),
|
||||
{"a": 1, "b": myval},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user