pyo3/tests/ui/invalid_macro_args.rs

34 lines
900 B
Rust
Raw Normal View History

2020-03-06 05:01:27 +00:00
use pyo3::prelude::*;
#[pyfunction(a = 5, b)]
2022-03-23 07:07:28 +00:00
fn pos_after_kw(py: Python<'_>, a: i32, b: i32) -> PyObject {
2020-03-06 05:01:27 +00:00
[a.to_object(py), vararg.into()].to_object(py)
}
#[pyfunction(kwargs = "**", a = 5)]
2022-03-23 07:07:28 +00:00
fn kw_after_kwargs(py: Python<'_>, kwargs: &PyDict, a: i32) -> PyObject {
2020-03-06 05:01:27 +00:00
[a.to_object(py), vararg.into()].to_object(py)
}
#[pyfunction(a, "*", b, "/", c)]
2022-03-23 07:07:28 +00:00
fn pos_only_after_kw_only(py: Python<'_>, a: i32, b: i32, c: i32) -> i32 {
a + b + c
}
#[pyfunction(a, args="*", "/", b)]
2022-03-23 07:07:28 +00:00
fn pos_only_after_args(py: Python<'_>, a: i32, args: Vec<i32>, b: i32) -> i32 {
a + b + c
}
#[pyfunction(a, kwargs="**", "/", b)]
2022-03-23 07:07:28 +00:00
fn pos_only_after_kwargs(py: Python<'_>, a: i32, args: Vec<i32>, b: i32) -> i32 {
a + b
}
#[pyfunction(kwargs = "**", "*", a)]
2022-03-23 07:07:28 +00:00
fn kw_only_after_kwargs(py: Python<'_>, kwargs: &PyDict, a: i32) -> PyObject {
[a.to_object(py), vararg.into()].to_object(py)
}
2020-03-06 05:01:27 +00:00
fn main() {}