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

Function test_seq_concat

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

Source from the content-addressed store, hash-verified

505
506 #[test]
507 fn test_seq_concat() {
508 let gil = Python::acquire_gil();
509 let py = gil.python();
510 let v: Vec<i32> = vec![1, 2, 3];
511 let seq = v
512 .to_py_object(py)
513 .into_object()
514 .cast_into::<PySequence>(py)
515 .unwrap();
516 let concat_seq = seq
517 .concat(py, &seq)
518 .unwrap()
519 .cast_into::<PySequence>(py)
520 .unwrap();
521 assert_eq!(6, concat_seq.len(py).unwrap());
522 let concat_v: Vec<i32> = vec![1, 2, 3, 1, 2, 3];
523 for (el, cc) in seq.iter(py).unwrap().zip(concat_v) {
524 assert_eq!(cc, el.unwrap().extract::<i32>(py).unwrap());
525 }
526 }
527
528 #[test]
529 fn test_seq_concat_string() {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected