Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_ne in test_cmp.py for Python 3.13 #1255

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/attr/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
PY_3_9_PLUS = sys.version_info[:2] >= (3, 9)
PY310 = sys.version_info[:2] >= (3, 10)
PY_3_12_PLUS = sys.version_info[:2] >= (3, 12)
PY_3_13_PLUS = sys.version_info[:2] >= (3, 13)


if sys.version_info < (3, 8):
Expand Down
11 changes: 7 additions & 4 deletions tests/test_cmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
Tests for methods from `attrib._cmp`.
"""


import pytest

from attr._cmp import cmp_using
from attr._compat import PY_3_13_PLUS


# Test parameters.
Expand Down Expand Up @@ -54,6 +54,9 @@
cmp_data = eq_data + order_data
cmp_ids = eq_ids + order_ids

# Compiler strips indents from docstrings in Python 3.13+
indent = "" if PY_3_13_PLUS else " " * 8


class TestEqOrder:
"""
Expand Down Expand Up @@ -325,7 +328,7 @@ def test_ne(self):
method = self.cls.__ne__
assert method.__doc__.strip() == (
"Check equality and either forward a NotImplemented or\n"
" return the result negated."
f"{indent}return the result negated."
)
assert method.__name__ == "__ne__"

Expand Down Expand Up @@ -393,7 +396,7 @@ def test_ne(self):
method = self.cls.__ne__
assert method.__doc__.strip() == (
"Check equality and either forward a NotImplemented or\n"
" return the result negated."
f"{indent}return the result negated."
)
assert method.__name__ == "__ne__"

Expand Down Expand Up @@ -465,7 +468,7 @@ def test_ne(self):
method = self.cls.__ne__
assert method.__doc__.strip() == (
"Check equality and either forward a NotImplemented or\n"
" return the result negated."
f"{indent}return the result negated."
)
assert method.__name__ == "__ne__"

Expand Down