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

Function test_compare

src/objectprotocol.rs:383–391  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

381
382 #[test]
383 fn test_compare() {
384 use std::cmp::Ordering;
385 let gil = Python::acquire_gil();
386 let py = gil.python();
387 let one = 1i32.to_py_object(py).into_object();
388 assert_eq!(one.compare(py, 1).unwrap(), Ordering::Equal);
389 assert_eq!(one.compare(py, 2).unwrap(), Ordering::Less);
390 assert_eq!(one.compare(py, 0).unwrap(), Ordering::Greater);
391 }
392}

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