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

Function test_append

src/objects/list.rs:237–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235
236 #[test]
237 fn test_append() {
238 let gil = Python::acquire_gil();
239 let py = gil.python();
240 let v = vec![2, 3, 5, 7];
241 let list = v.to_py_object(py);
242 let val = 42i32.to_py_object(py).into_object();
243 assert_eq!(4, list.len(py));
244 list.append(py, val);
245 assert_eq!(5, list.len(py));
246 assert_eq!(42, list.get_item(py, 4).extract::<i32>(py).unwrap());
247 }
248
249 #[test]
250 fn test_iter() {

Callers

nothing calls this directly

Calls 4

pythonMethod · 0.80
appendMethod · 0.80
to_py_objectMethod · 0.45
into_objectMethod · 0.45

Tested by

no test coverage detected