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

Function instance_method

tests/test_class.rs:181–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179
180#[test]
181fn instance_method() {
182 let gil = Python::acquire_gil();
183 let py = gil.python();
184
185 let obj = InstanceMethod::create_instance(py, 42).unwrap();
186 assert!(obj.method(py).unwrap() == 42);
187 let d = PyDict::new(py);
188 d.set_item(py, "obj", obj).unwrap();
189 py.run("assert obj.method() == 42", None, Some(&d)).unwrap();
190}
191
192py_class!(class InstanceMethodReturnsNone |py| {
193 data member: AtomicUsize;

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
runMethod · 0.80
set_itemMethod · 0.45

Tested by

no test coverage detected