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

Function rich_comparisons

tests/test_class.rs:923–946  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

921
922#[test]
923fn rich_comparisons() {
924 let gil = Python::acquire_gil();
925 let py = gil.python();
926
927 let c = RichComparisons::create_instance(py).unwrap();
928 py_run!(py, c, "assert (c < c) == 'RC < RC'");
929 py_run!(py, c, "assert (c < 1) == 'RC < 1'");
930 py_run!(py, c, "assert (1 < c) == 'RC > 1'");
931 py_run!(py, c, "assert (c <= c) == 'RC <= RC'");
932 py_run!(py, c, "assert (c <= 1) == 'RC <= 1'");
933 py_run!(py, c, "assert (1 <= c) == 'RC >= 1'");
934 py_run!(py, c, "assert (c == c) == 'RC == RC'");
935 py_run!(py, c, "assert (c == 1) == 'RC == 1'");
936 py_run!(py, c, "assert (1 == c) == 'RC == 1'");
937 py_run!(py, c, "assert (c != c) == 'RC != RC'");
938 py_run!(py, c, "assert (c != 1) == 'RC != 1'");
939 py_run!(py, c, "assert (1 != c) == 'RC != 1'");
940 py_run!(py, c, "assert (c > c) == 'RC > RC'");
941 py_run!(py, c, "assert (c > 1) == 'RC > 1'");
942 py_run!(py, c, "assert (1 > c) == 'RC < 1'");
943 py_run!(py, c, "assert (c >= c) == 'RC >= RC'");
944 py_run!(py, c, "assert (c >= 1) == 'RC >= 1'");
945 py_run!(py, c, "assert (1 >= c) == 'RC <= 1'");
946}
947
948#[test]
949#[cfg(feature = "python3-sys")]

Callers

nothing calls this directly

Calls 1

pythonMethod · 0.80

Tested by

no test coverage detected