@@ -389,24 +389,6 @@ fn rhs_arithmetic() {
389389 } ) ;
390390}
391391
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-
410392#[ pyclass]
411393struct LhsAndRhs { }
412394
@@ -611,7 +593,12 @@ fn rich_comparisons() {
611593 py_run ! ( py, c, "assert (1 >= c) == 'RC <= 1'" ) ;
612594
613595 // 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 ) ;
596+ py_expect_exception ! ( py, c, "type(c).__lt__(object(), 1)" , PyTypeError ) ;
597+ py_expect_exception ! ( py, c, "type(c).__le__(object(), 1)" , PyTypeError ) ;
598+ py_expect_exception ! ( py, c, "type(c).__eq__(object(), 1)" , PyTypeError ) ;
599+ py_expect_exception ! ( py, c, "type(c).__ne__(object(), 1)" , PyTypeError ) ;
600+ py_expect_exception ! ( py, c, "type(c).__gt__(object(), 1)" , PyTypeError ) ;
601+ py_expect_exception ! ( py, c, "type(c).__ge__(object(), 1)" , PyTypeError ) ;
615602 } ) ;
616603}
617604
0 commit comments