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

Function test_extract_str

src/objects/string.rs:582–594  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

580
581 #[test]
582 fn test_extract_str() {
583 let gil = Python::acquire_gil();
584 let py = gil.python();
585 let s = "Hello Python";
586 let py_string = s.to_py_object(py).into_object();
587 let mut called = false;
588 RefFromPyObject::with_extracted(py, &py_string, |s2: &str| {
589 assert_eq!(s, s2);
590 called = true;
591 })
592 .unwrap();
593 assert!(called);
594 }
595
596 #[test]
597 fn test_extract_byte_str() {

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
into_objectMethod · 0.45
to_py_objectMethod · 0.45

Tested by

no test coverage detected