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

Test failures with Python 3.13: stripped indentation from docstrings #1228

Closed
befeleme opened this issue Jan 29, 2024 · 1 comment · Fixed by #1255
Closed

Test failures with Python 3.13: stripped indentation from docstrings #1228

befeleme opened this issue Jan 29, 2024 · 1 comment · Fixed by #1255

Comments

@befeleme
Copy link

In Python 3.13, compiler strips indents from docstrings. See python/cpython#81283

_______________________ TestDundersUnnamedClass.test_ne ________________________

self = <tests.test_cmp.TestDundersUnnamedClass object at 0x7f8f99705280>

    def test_ne(self):
        """
        __ne__ docstring and qualified name should be well behaved.
        """
        method = self.cls.__ne__
>       assert method.__doc__.strip() == (
            "Check equality and either forward a NotImplemented or\n"
            "        return the result negated."
        )
E       AssertionError: assert 'Check equality and either forward a NotImplemented or\nreturn the result negated.' == 'Check equality and either forward a NotImplemented or\n        return the result negated.'
E           Check equality and either forward a NotImplemented or
E         -         return the result negated.
E         ? --------
E         + return the result negated.

tests/test_cmp.py:326: AssertionError
______________________ TestDundersPartialOrdering.test_ne ______________________

self = <tests.test_cmp.TestDundersPartialOrdering object at 0x7f8f99705010>

    def test_ne(self):
        """
        __ne__ docstring and qualified name should be well behaved.
        """
        method = self.cls.__ne__
>       assert method.__doc__.strip() == (
            "Check equality and either forward a NotImplemented or\n"
            "        return the result negated."
        )
E       AssertionError: assert 'Check equality and either forward a NotImplemented or\nreturn the result negated.' == 'Check equality and either forward a NotImplemented or\n        return the result negated.'
E           Check equality and either forward a NotImplemented or
E         -         return the result negated.
E         ? --------
E         + return the result negated.

tests/test_cmp.py:394: AssertionError
_______________________ TestDundersFullOrdering.test_ne ________________________

self = <tests.test_cmp.TestDundersFullOrdering object at 0x7f8f99704b30>

    def test_ne(self):
        """
        __ne__ docstring and qualified name should be well behaved.
        """
        method = self.cls.__ne__
>       assert method.__doc__.strip() == (
            "Check equality and either forward a NotImplemented or\n"
            "        return the result negated."
        )
E       AssertionError: assert 'Check equality and either forward a NotImplemented or\nreturn the result negated.' == 'Check equality and either forward a NotImplemented or\n        return the result negated.'
E           Check equality and either forward a NotImplemented or
E         -         return the result negated.
E         ? --------
E         + return the result negated.

tests/test_cmp.py:466: AssertionError
@webknjaz
Copy link
Member

Action item: make the test conditional with the new behavior checked under Python 3.13+ and the old one checked otherwise.

frenzymadness added a commit to frenzymadness/attrs that referenced this issue Mar 7, 2024
Compiler in Python 3.13+ strips indents from docstrings
so they need to be compared without it for new Pythons.

Fixes: python-attrs#1228
frenzymadness added a commit to frenzymadness/attrs that referenced this issue Mar 7, 2024
Compiler in Python 3.13+ strips indents from docstrings
so they need to be compared without it for new Pythons.

Fixes: python-attrs#1228
github-merge-queue bot pushed a commit that referenced this issue Mar 7, 2024
* Fix test_ne in test_cmp.py for Python 3.13

Compiler in Python 3.13+ strips indents from docstrings
so they need to be compared without it for new Pythons.

Fixes: #1228

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants