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

Function test_seq_iter

src/objects/sequence.rs:471–486  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

469
470 #[test]
471 fn test_seq_iter() {
472 let gil = Python::acquire_gil();
473 let py = gil.python();
474 let v: Vec<i32> = vec![1, 1, 2, 3, 5, 8];
475 let seq = v
476 .to_py_object(py)
477 .into_object()
478 .cast_into::<PySequence>(py)
479 .unwrap();
480 let mut idx = 0;
481 for el in seq.iter(py).unwrap() {
482 assert_eq!(v[idx], el.unwrap().extract::<i32>(py).unwrap());
483 idx += 1;
484 }
485 assert_eq!(idx, v.len());
486 }
487
488 #[test]
489 fn test_seq_strings() {

Callers

nothing calls this directly

Calls 4

pythonMethod · 0.80
into_objectMethod · 0.45
to_py_objectMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected