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

Function test_hashmap_to_python

src/objects/tests.rs:25–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23// TODO: move these tests into the dict module
24#[test]
25fn test_hashmap_to_python() {
26 let gil = Python::acquire_gil();
27 let py = gil.python();
28
29 let mut map = HashMap::<i32, i32>::new();
30 map.insert(1, 1);
31
32 let py_map = map.to_py_object(py);
33
34 assert!(py_map.len(py) == 1);
35 assert!(py_map.get_item(py, 1).unwrap().extract::<i32>(py).unwrap() == 1);
36}
37
38#[test]
39fn test_btreemap_to_python() {

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
insertMethod · 0.80
to_py_objectMethod · 0.45

Tested by

no test coverage detected