This commit is contained in:
Hynek Schlawack 2021-02-22 08:59:09 +01:00
parent aefdb117fa
commit 44ac461146
3 changed files with 4 additions and 5 deletions

View File

@ -0,0 +1 @@
It's now possible to customize the behavior of ``eq`` and ``order`` by passing in a callable.

View File

@ -1061,7 +1061,7 @@ _CMP_DEPRECATION = (
)
_EQ_ORDER_CUSTOMIZATION = (
"You have customized the behaviour of `eq` but not of `order`. "
"You have customized the behavior of `eq` but not of `order`. "
"This is probably a bug."
)
@ -2484,7 +2484,7 @@ class Attribute(object):
.. versionadded:: 20.1.0 *on_setattr*
.. versionchanged:: 20.2.0 *inherited* is not taken into account for
equality checks and hashing anymore.
.. versionadded:: 20.X.Y *eq_key* and *order_key*
.. versionadded:: 21.1.0 *eq_key* and *order_key*
For the full version history of the fields, see `attr.ib`.
"""
@ -2660,9 +2660,7 @@ _a = [
repr=True,
cmp=None,
eq=True,
# eq_key=None,
order=False,
# order_key=None,
hash=(name != "metadata"),
init=True,
inherited=False,

View File

@ -1927,7 +1927,7 @@ class TestDetermineAttribEqOrder(object):
(w,) = wr.list
assert (
"You have customized the behaviour of `eq` but not of `order`. "
"You have customized the behavior of `eq` but not of `order`. "
"This is probably a bug." == w.message.args[0]
)