MCPcopy Index your code
hub / github.com/dgrunwald/rust-cpython / test_extract_byte_str

Function test_extract_byte_str

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

Source from the content-addressed store, hash-verified

595
596 #[test]
597 fn test_extract_byte_str() {
598 let gil = Python::acquire_gil();
599 let py = gil.python();
600 let py_bytes = py.eval("b'Hello'", None, None).unwrap();
601 let mut called = false;
602 RefFromPyObject::with_extracted(py, &py_bytes, |s2: &[u8]| {
603 assert_eq!(b"Hello", s2);
604 called = true;
605 })
606 .unwrap();
607 assert!(called);
608 }
609
610 #[test]
611 #[cfg(feature = "nightly")] // only works with specialization

Callers

nothing calls this directly

Calls 2

pythonMethod · 0.80
evalMethod · 0.80

Tested by

no test coverage detected