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

Function static_data

tests/test_class.rs:363–372  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

361
362#[test]
363fn static_data() {
364 let gil = Python::acquire_gil();
365 let py = gil.python();
366
367 let d = PyDict::new(py);
368 d.set_item(py, "C", py.get_type::<StaticData>()).unwrap();
369 py.run("assert C.VAL1 == 123", None, Some(&d)).unwrap();
370 py.run("assert C.VAL2 is None", None, Some(&d)).unwrap();
371 assert!(py.run("C.VAL1 = 124", None, Some(&d)).is_err());
372}
373
374py_class!(class GCIntegration |py| {
375 data self_ref: RefCell<PyObject>;

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
runMethod · 0.80
set_itemMethod · 0.45

Tested by

no test coverage detected