MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / class_method

Function class_method

tests/test_class.rs:261–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259
260#[test]
261fn 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
281py_class!(class ClassMethodWithArgs |py| {
282 @classmethod

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
runMethod · 0.80
set_itemMethod · 0.45

Tested by

no test coverage detected