MCPcopy Create free account
hub / github.com/PyO3/pyo3 / test_array_intopyobject_impl

Function test_array_intopyobject_impl

src/conversions/std/array.rs:316–328  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

314
315 #[test]
316 fn test_array_intopyobject_impl() {
317 Python::attach(|py| {
318 let bytes: [u8; 6] = *b"foobar";
319 let obj = bytes.into_pyobject(py).unwrap();
320 assert!(obj.is_instance_of::<PyBytes>());
321 let obj = obj.cast_into::<PyBytes>().unwrap();
322 assert_eq!(obj.as_bytes(), &bytes);
323
324 let nums: [u16; 4] = [0, 1, 2, 3];
325 let obj = nums.into_pyobject(py).unwrap();
326 assert!(obj.is_instance_of::<PyList>());
327 });
328 }
329
330 #[test]
331 fn test_extract_non_iterable_to_array() {

Callers

nothing calls this directly

Calls 1

into_pyobjectMethod · 0.45

Tested by

no test coverage detected