pyo3/tests
bors[bot] dbf7b233aa
Merge #3203
3203: support ordering magic methods for `#[pyclass]` r=adamreichold a=davidhewitt

Closes #2089 

This adds `__lt__`, `__le__`, `__eq__`, `__ne__`, `__gt__`, and `__ge__` as per the Python implementations of what we call `__richcmp__`.

There's a UI test confirming that the user cannot implement split forms and `__richcmp__` simultaneously.

There's also a benchmark comparing implementing these split methods against using `__richcmp__`. I couldn't see a meaningful performance difference, so I'm tempted to deprecate `__richcmp__`, given that's not a magic method which exists in Python. Potentially we can provide options such as the opt-in `#[pyclass(eq, ord)]` to avoid boilerplate for people who don't want to implement six different methods.



Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-06-05 07:13:23 +00:00
..
not_msrv
ui support ordering magic methods for `#[pyclass]` 2023-06-04 13:58:18 +01:00
common.rs Factor out UnraisableCapture helper type and use it to check that dropping unsendable elsewhere calls into sys.unraisablehook 2023-05-25 20:17:55 +02:00
test_anyhow.rs
test_append_to_inittab.rs
test_arithmetics.rs
test_buffer.rs
test_buffer_protocol.rs Factor out UnraisableCapture helper type and use it to check that dropping unsendable elsewhere calls into sys.unraisablehook 2023-05-25 20:17:55 +02:00
test_bytes.rs
test_class_attributes.rs run cargo check instead of clippy for MSRV in CI 2023-06-04 23:15:59 +01:00
test_class_basics.rs Factor out UnraisableCapture helper type and use it to check that dropping unsendable elsewhere calls into sys.unraisablehook 2023-05-25 20:17:55 +02:00
test_class_conversion.rs
test_class_new.rs
test_compile_error.rs Replace the nightly UI tests by doctests since we cannot keep up with the changing error outputs of nightly in any case. 2023-05-25 21:37:32 +02:00
test_datetime.rs
test_default_impls.rs
test_dict_iter.rs
test_enum.rs
test_exceptions.rs Factor out UnraisableCapture helper type and use it to check that dropping unsendable elsewhere calls into sys.unraisablehook 2023-05-25 20:17:55 +02:00
test_field_cfg.rs
test_frompyobject.rs fix clippy warnings uncovered by msrv bump 2023-06-05 07:08:27 +01:00
test_gc.rs Add additional tests for #3165. 2023-05-25 21:31:17 +02:00
test_getter_setter.rs fix clippy warnings uncovered by msrv bump 2023-06-05 07:08:27 +01:00
test_inheritance.rs
test_macros.rs
test_mapping.rs
test_methods.rs
test_module.rs
test_multiple_pymethods.rs
test_no_imports.rs fix clippy warnings uncovered by msrv bump 2023-06-05 07:08:27 +01:00
test_not_msrv.rs
test_pep_587.rs
test_proto_methods.rs fix clippy warnings uncovered by msrv bump 2023-06-05 07:08:27 +01:00
test_pyfunction.rs
test_pyself.rs
test_sequence.rs
test_serde.rs
test_static_slots.rs
test_string.rs
test_super.rs
test_text_signature.rs
test_unsendable_dict.rs
test_variable_arguments.rs
test_variable_arguments_deprecated.rs
test_various.rs
test_wrap_pyfunction_deduction.rs