Skip to content

Commit 7170fda

Browse files
fix broken tests
1 parent 0462993 commit 7170fda

1 file changed

Lines changed: 6 additions & 20 deletions

File tree

tests/test_arithmetics.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use pyo3::class::basic::CompareOp;
44
use pyo3::py_run;
5-
use pyo3::types::IntoPyDict;
65
use pyo3::{prelude::*, BoundObject};
76

87
mod test_utils;
@@ -389,24 +388,6 @@ fn rhs_arithmetic() {
389388
});
390389
}
391390

392-
#[test]
393-
fn rhs_fallback() {
394-
Python::attach(|py| {
395-
let cl = Py::new(py, RhsArithmetic("AR".to_string())).unwrap();
396-
let cr = Py::new(py, RhsArithmetic("RA".to_string())).unwrap();
397-
let locals = [("cl", cl), ("cr", cr)].into_py_dict(py).unwrap();
398-
py_run!(py, locals, "assert cl + cr == 'AR + RA'");
399-
py_run!(py, locals, "assert cl - cr == 'AR - RA'");
400-
py_run!(py, locals, "assert cl * cr == 'AR * RA'");
401-
py_run!(py, locals, "assert cl << cr == 'AR << RA'");
402-
py_run!(py, locals, "assert cl >> cr == 'AR >> RA'");
403-
py_run!(py, locals, "assert cl & cr == 'AR & RA'");
404-
py_run!(py, locals, "assert cl ^ cr == 'AR ^ RA'");
405-
py_run!(py, locals, "assert cl | cr == 'AR | RA'");
406-
py_run!(py, locals, "assert cl ** cr == 'AR ** RA (mod: None)'");
407-
});
408-
}
409-
410391
#[pyclass]
411392
struct LhsAndRhs {}
412393

@@ -611,7 +592,12 @@ fn rich_comparisons() {
611592
py_run!(py, c, "assert (1 >= c) == 'RC <= 1'");
612593

613594
// Ensure that passing a wrong self type from Python does not cause UB
614-
py_expect_exception!(py, c, "type(c).__richcmp__(object(), 1)", PyTypeError);
595+
py_expect_exception!(py, c, "type(c).__lt__(object(), 1)", PyTypeError);
596+
py_expect_exception!(py, c, "type(c).__le__(object(), 1)", PyTypeError);
597+
py_expect_exception!(py, c, "type(c).__eq__(object(), 1)", PyTypeError);
598+
py_expect_exception!(py, c, "type(c).__ne__(object(), 1)", PyTypeError);
599+
py_expect_exception!(py, c, "type(c).__gt__(object(), 1)", PyTypeError);
600+
py_expect_exception!(py, c, "type(c).__ge__(object(), 1)", PyTypeError);
615601
});
616602
}
617603

0 commit comments

Comments
 (0)