Skip to content

Commit

Permalink
cover more invalid macro cases
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Sep 30, 2023
1 parent 3c5b752 commit 79b712d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/ui/invalid_pymethod_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,17 @@ impl TestClass {
fn new(&self) -> Self { Self { num: 0 } }
}

#[pymethods]
impl TestClass {
#[getter(1)]
fn get_one(&self) -> Self { Self { num: 0 } }
}

#[pymethods]
impl TestClass {
#[getter = 1]
fn get_two(&self) -> Self { Self { num: 0 } }
}


fn main() {}
12 changes: 12 additions & 0 deletions tests/ui/invalid_pymethod_names.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ error: `name` not allowed with `#[new]`
|
24 | #[pyo3(name = "makenew")]
| ^^^^^^^^^

error: expected ident or string literal for property name
--> tests/ui/invalid_pymethod_names.rs:31:14
|
31 | #[getter(1)]
| ^

error: expected `#[getter(name)]` to set the name
--> tests/ui/invalid_pymethod_names.rs:37:14
|
37 | #[getter = 1]
| ^

0 comments on commit 79b712d

Please sign in to comment.