pyo3/tests
Michael Gilbert b8fb367582
feat: Add 'ord' option for PyClass and corresponding tests (#4202)
* feat: Add 'ord' option for PyClass and corresponding tests

Updated the macros back-end to include 'ord' as an option for PyClass allowing for Python-style ordering comparison of enum variants. Additionally, test cases to verify the proper functioning of this new feature have been introduced.

* update: fix formatting with cargo fmt

* update: documented added feature in newsfragments

* update: updated saved errors for comparison test for invalid pyclass args

* update: removed nested match arms and extended cases for ordering instead

* update: alphabetically ordered entries

* update: added section to class documentation with example for using ord argument.

* refactor: reduced duplication of code using closure to process tokens.

* update: used ensure_spanned macro to emit compile time errors for uses of ord on complex enums or structs, updated test errors for bad compile cases

* fix: remove errant character

* update: added note about PartialOrd being required.

* feat: implemented ordering for structs and complex enums.  Retained the equality logic for simple enums until PartialEq is deprecated.

* update: adjusted compile time error checks for missing PartialOrd implementations.  Refactored growing set of comparison tests for simple and complex enums and structs into separate test file.

* fix: updated with clippy findings

* update: added not to pyclass parameters on ord (assumes that eq will be implemented and merged first)

* update: rebased on main after merging of `eq` feature

* update: format update

* update: update all test output and doc tests

* Update guide/src/class.md

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* Update pyo3-macros-backend/src/pyclass.rs

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* Update newsfragments/4202.added.md

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* Update guide/pyclass-parameters.md

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* update: added note about `ord` implementation with example.

* fix doc formatting

---------

Co-authored-by: Michael Gilbert <git.3mc1o@aleeas.com>
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-06-07 19:08:53 +00:00
..
ui feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
test_anyhow.rs deprecate `wrap_pyfunction` with `py` argument (#3954) 2024-03-12 22:57:03 +00:00
test_append_to_inittab.rs Use single-arg form of `#[pymodule]` function in docs and tests (#3899) 2024-02-28 22:36:50 +00:00
test_arithmetics.rs deprecate implicit default for trailing optional arguments (#4078) 2024-05-10 10:34:58 +00:00
test_buffer.rs fix `AsRef` and `Deref` impls on `Bound<T>` (#3879) 2024-02-22 22:38:42 +00:00
test_buffer_protocol.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_bytes.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_class_attributes.rs port `Python::get_type` to `Bound` API (#3846) 2024-02-18 18:27:19 +00:00
test_class_basics.rs Use `Ident::parse_any` for `name` attributes (#4226) 2024-06-03 19:45:36 +00:00
test_class_comparisons.rs feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
test_class_conversion.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_class_new.rs Added `From<Bound<'py, T>>` impl for `PyClassInitializer<T>`. (#4214) 2024-05-28 01:49:52 +00:00
test_compile_error.rs Emit a better error for abi3 inheritance (#4185) 2024-05-17 10:55:41 +00:00
test_coroutine.rs Update MSRV to 1.63 (#4129) 2024-04-28 16:11:28 +00:00
test_datetime.rs port `Python::import` to `Bound` API (#3832) 2024-02-14 00:24:37 +00:00
test_datetime_import.rs port `Python::import` to `Bound` API (#3832) 2024-02-14 00:24:37 +00:00
test_declarative_module.rs Automated module= field creation in declarative modules (#4213) 2024-06-06 07:54:26 +00:00
test_default_impls.rs add pyclass `eq` option (#4210) 2024-05-31 14:13:30 +00:00
test_dict_iter.rs port `IntoPyDict` to `Bound` API 2024-02-10 15:47:26 +01:00
test_enum.rs feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
test_exceptions.rs feature gate deprecated APIs for `PyErr` and exceptions (#4136) 2024-04-30 16:58:53 +00:00
test_field_cfg.rs fix `AsRef` and `Deref` impls on `Bound<T>` (#3879) 2024-02-22 22:38:42 +00:00
test_frompyobject.rs update `#[derive(FromPyObject)]` to use `extract_bound` (#3828) 2024-02-13 00:09:41 +00:00
test_gc.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_getter_setter.rs use `extract_argument` for `#[setter]` extraction (#3998) 2024-03-27 15:41:04 +00:00
test_inheritance.rs deprecate GIL refs in function argument (#3847) 2024-03-20 22:35:08 +00:00
test_macro_docs.rs port `Python::get_type` to `Bound` API (#3846) 2024-02-18 18:27:19 +00:00
test_macros.rs deprecate `wrap_pyfunction` with `py` argument (#3954) 2024-03-12 22:57:03 +00:00
test_mapping.rs deprecate implicit default for trailing optional arguments (#4078) 2024-05-10 10:34:58 +00:00
test_methods.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_module.rs feature gate APIs using `into_gil_ref` (Part 2) (#4166) 2024-05-09 22:21:48 +00:00
test_multiple_pymethods.rs port `Python::get_type` to `Bound` API (#3846) 2024-02-18 18:27:19 +00:00
test_no_imports.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_proto_methods.rs feature gate APIs using `into_gil_ref` (Part 2) (#4166) 2024-05-09 22:21:48 +00:00
test_pyfunction.rs Use `Ident::parse_any` for `name` attributes (#4226) 2024-06-03 19:45:36 +00:00
test_pyself.rs deprecate the use of `PyCell` in favor of `Bound` and `Py` (#3916) 2024-03-03 14:47:25 +00:00
test_sequence.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_serde.rs Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
test_static_slots.rs port `Python::get_type` to `Bound` API (#3846) 2024-02-18 18:27:19 +00:00
test_string.rs deprecate `wrap_pyfunction` with `py` argument (#3954) 2024-03-12 22:57:03 +00:00
test_super.rs deprecate the use of `PyCell` in favor of `Bound` and `Py` (#3916) 2024-03-03 14:47:25 +00:00
test_text_signature.rs deprecate implicit default for trailing optional arguments (#4078) 2024-05-10 10:34:58 +00:00
test_unsendable_dict.rs
test_variable_arguments.rs deprecate GIL refs in function argument (#3847) 2024-03-20 22:35:08 +00:00
test_various.rs deprecate `wrap_pyfunction` with `py` argument (#3954) 2024-03-12 22:57:03 +00:00
test_wrap_pyfunction_deduction.rs feature gate `as/into_gil_ref` APIs (Part 3) (#4172) 2024-05-10 17:03:57 +00:00