pyo3/tests/ui
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
..
abi3_inheritance.rs Emit a better error for abi3 inheritance (#4185) 2024-05-17 10:55:41 +00:00
abi3_inheritance.stderr Emit a better error for abi3 inheritance (#4185) 2024-05-17 10:55:41 +00:00
abi3_nativetype_inheritance.rs Assorted updates to the abi3 branch from review 2020-10-11 19:51:27 -04:00
abi3_nativetype_inheritance.stderr Emit a better error for abi3 inheritance (#4185) 2024-05-17 10:55:41 +00:00
deprecations.rs add pyclass `eq` option (#4210) 2024-05-31 14:13:30 +00:00
deprecations.stderr add pyclass `eq` option (#4210) 2024-05-31 14:13:30 +00:00
get_set_all.rs Implement get/set all on pyclass 2022-10-17 02:37:43 +02:00
get_set_all.stderr Create better error spans/messages 2022-10-18 21:14:22 +02:00
invalid_argument_attributes.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_argument_attributes.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_cancel_handle.rs Refactoring of `FnArg` (#4033) 2024-04-14 14:19:57 +00:00
invalid_cancel_handle.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_closure.rs Update new_closure_bound closure signature (#3883) 2024-02-23 14:07:54 +00:00
invalid_closure.stderr Update new_closure_bound closure signature (#3883) 2024-02-23 14:07:54 +00:00
invalid_frompy_derive.rs test: improve cov 2023-04-27 12:44:38 +08:00
invalid_frompy_derive.stderr test: improve cov 2023-04-27 12:44:38 +08:00
invalid_frozen_pyclass_borrow.rs deprecate the use of `PyCell` in favor of `Bound` and `Py` (#3916) 2024-03-03 14:47:25 +00:00
invalid_frozen_pyclass_borrow.stderr deprecate GIL refs in function argument (#3847) 2024-03-20 22:35:08 +00:00
invalid_intern_arg.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_intern_arg.stderr feature gate `PyCell` (#4177) 2024-05-12 18:30:08 +00:00
invalid_property_args.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_property_args.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_proto_pymethods.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_proto_pymethods.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pyclass_args.rs feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
invalid_pyclass_args.stderr feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
invalid_pyclass_enum.rs feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
invalid_pyclass_enum.stderr feat: Add 'ord' option for PyClass and corresponding tests (#4202) 2024-06-07 19:08:53 +00:00
invalid_pyclass_item.rs Refactor #[pyclass] and now it supports enum. 2021-11-21 20:05:53 +08:00
invalid_pyclass_item.stderr Refactor #[pyclass] and now it supports enum. 2021-11-21 20:05:53 +08:00
invalid_pyfunction_signatures.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pyfunction_signatures.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pyfunctions.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pyfunctions.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pymethod_enum.rs feat: support pyclass on tuple enums (#4072) 2024-05-17 02:59:00 +00:00
invalid_pymethod_enum.stderr feat: support pyclass on tuple enums (#4072) 2024-05-17 02:59:00 +00:00
invalid_pymethod_names.rs error on passing arguments to `#[new]` and similar attributes 2023-10-08 21:31:59 +01:00
invalid_pymethod_names.stderr error on passing arguments to `#[new]` and similar attributes 2023-10-08 21:31:59 +01:00
invalid_pymethod_receiver.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pymethod_receiver.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pymethods.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pymethods.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
invalid_pymethods_buffer.rs pymethods: support buffer protocol 2021-12-30 15:48:55 +00:00
invalid_pymethods_buffer.stderr pymethods: support buffer protocol 2021-12-30 15:48:55 +00:00
invalid_pymethods_duplicates.rs improve error for invalid `#[classmethod]` receivers 2023-11-24 03:24:46 +00:00
invalid_pymethods_duplicates.stderr feature gate `PyCell` (#4177) 2024-05-12 18:30:08 +00:00
invalid_pymodule_args.rs Use single-arg form of `#[pymodule]` function in docs and tests (#3899) 2024-02-28 22:36:50 +00:00
invalid_pymodule_args.stderr deprecations: remove items deprecated in PyO3 0.14 2021-11-19 16:33:29 +00:00
invalid_pymodule_glob.rs #[pymodule] mod some_module { ... } v3 (#3815) 2024-02-24 13:50:18 +00:00
invalid_pymodule_glob.stderr #[pymodule] mod some_module { ... } v3 (#3815) 2024-02-24 13:50:18 +00:00
invalid_pymodule_in_root.rs #[pymodule] mod some_module { ... } v3 (#3815) 2024-02-24 13:50:18 +00:00
invalid_pymodule_in_root.stderr #[pymodule] mod some_module { ... } v3 (#3815) 2024-02-24 13:50:18 +00:00
invalid_pymodule_trait.rs #[pymodule] mod some_module { ... } v3 (#3815) 2024-02-24 13:50:18 +00:00
invalid_pymodule_trait.stderr Allow inline struct, enum, fn and mod inside of declarative modules (#3902) 2024-03-06 00:31:56 +00:00
invalid_pymodule_two_pymodule_init.rs #[pymodule] mod some_module { ... } v3 (#3815) 2024-02-24 13:50:18 +00:00
invalid_pymodule_two_pymodule_init.stderr Allow inline struct, enum, fn and mod inside of declarative modules (#3902) 2024-03-06 00:31:56 +00:00
invalid_result_conversion.rs deprecate `wrap_pyfunction` with `py` argument (#3954) 2024-03-12 22:57:03 +00:00
invalid_result_conversion.stderr feature gate APIs using `into_gil_ref` (Part 2) (#4166) 2024-05-09 22:21:48 +00:00
missing_intopy.rs Fix IntoPyCallbackOutput paper cuts (#2326) 2022-05-09 18:15:43 +01:00
missing_intopy.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
not_send.rs Add more lints 2022-03-23 08:07:28 +01:00
not_send.stderr ci: updates for Rust 1.77 (#3978) 2024-03-22 20:43:23 +00:00
not_send2.rs add `PyString::new_bound` 2024-01-29 13:14:00 +00:00
not_send2.stderr ci: updates for Rust 1.77 (#3978) 2024-03-22 20:43:23 +00:00
pyclass_send.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
pyclass_send.stderr ci: updates for Rust 1.77 (#3978) 2024-03-22 20:43:23 +00:00
pymodule_missing_docs.rs Declarative modules: make sure to emit doc comments and other attributes (#4236) 2024-06-06 21:19:37 +00:00
reject_generics.rs pyclass: better error and explanation why lifetimes are disallowed (#2633) 2022-09-22 11:14:06 +02:00
reject_generics.stderr fix: change to from_item_all 2023-04-26 19:47:07 +08:00
static_ref.rs deprecate GIL refs in function argument (#3847) 2024-03-20 22:35:08 +00:00
static_ref.stderr refactor `#[setter]` argument extraction (#4002) 2024-04-01 12:10:18 +00:00
traverse.rs ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
traverse.stderr ci: updates for Rust 1.78 (#4150) 2024-05-03 07:42:30 +00:00
wrong_aspyref_lifetimes.rs deprecate `PyDict::new` constructor (#3823) 2024-02-11 23:55:56 +00:00
wrong_aspyref_lifetimes.stderr feature gate `PyCell` (#4177) 2024-05-12 18:30:08 +00:00