()
| 259 | |
| 260 | #[test] |
| 261 | fn class_method() { |
| 262 | let gil = Python::acquire_gil(); |
| 263 | let py = gil.python(); |
| 264 | |
| 265 | let d = PyDict::new(py); |
| 266 | d.set_item(py, "C", py.get_type::<ClassMethod>()).unwrap(); |
| 267 | py.run( |
| 268 | "assert C.method() == 'ClassMethod.method()!'", |
| 269 | None, |
| 270 | Some(&d), |
| 271 | ) |
| 272 | .unwrap(); |
| 273 | py.run( |
| 274 | "assert C().method() == 'ClassMethod.method()!'", |
| 275 | None, |
| 276 | Some(&d), |
| 277 | ) |
| 278 | .unwrap(); |
| 279 | } |
| 280 | |
| 281 | py_class!(class ClassMethodWithArgs |py| { |
| 282 | @classmethod |