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

Function test_seq_strings

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

Source from the content-addressed store, hash-verified

487
488 #[test]
489 fn test_seq_strings() {
490 let gil = Python::acquire_gil();
491 let py = gil.python();
492 let v = vec!["It", "was", "the", "worst", "of", "times"];
493 let seq = v
494 .to_py_object(py)
495 .into_object()
496 .cast_into::<PySequence>(py)
497 .unwrap();
498
499 let bad_needle = "blurst".to_py_object(py);
500 assert_eq!(false, seq.contains(py, bad_needle).unwrap());
501
502 let good_needle = "worst".to_py_object(py);
503 assert_eq!(true, seq.contains(py, good_needle).unwrap());
504 }
505
506 #[test]
507 fn test_seq_concat() {

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