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

Function static_method_with_args

tests/test_class.rs:345–355  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

343
344#[test]
345fn static_method_with_args() {
346 let gil = Python::acquire_gil();
347 let py = gil.python();
348
349 assert_eq!(StaticMethodWithArgs::method(py, 1234).unwrap(), "0x4d2");
350 let d = PyDict::new(py);
351 d.set_item(py, "C", py.get_type::<StaticMethodWithArgs>())
352 .unwrap();
353 py.run("assert C.method(1337) == '0x539'", None, Some(&d))
354 .unwrap();
355}
356
357py_class!(class StaticData |py| {
358 static VAL1 = 123;

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
runMethod · 0.80
set_itemMethod · 0.45

Tested by

no test coverage detected