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

Function static_method

tests/test_class.rs:316–335  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

314
315#[test]
316fn static_method() {
317 let gil = Python::acquire_gil();
318 let py = gil.python();
319
320 assert_eq!(StaticMethod::method(py).unwrap(), "StaticMethod.method()!");
321 let d = PyDict::new(py);
322 d.set_item(py, "C", py.get_type::<StaticMethod>()).unwrap();
323 py.run(
324 "assert C.method() == 'StaticMethod.method()!'",
325 None,
326 Some(&d),
327 )
328 .unwrap();
329 py.run(
330 "assert C().method() == 'StaticMethod.method()!'",
331 None,
332 Some(&d),
333 )
334 .unwrap();
335}
336
337py_class!(class StaticMethodWithArgs |py| {
338 @staticmethod

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
runMethod · 0.80
set_itemMethod · 0.45

Tested by

no test coverage detected