Skip to content

Two tests are failing in 5.2.1 with Python 3.13.0a5 #1311

@penguinpee

Description

@penguinpee

With the latest alpha release of Python 3.13 two tests are failing again. This happens in both version 5.2.0 and version 5.2.1 with Python 3.13.0a5.

In issue #1295 @sanjayankur31 reported all tests succeeding in version 5.2.0. But that was with Python 3.13.0a4.

=================================== FAILURES ===================================
_____________________ TestNibabelDeprecator.test_dep_func ______________________

self = <nibabel.tests.test_deprecated.TestNibabelDeprecator object at 0x7f7f64c8c980>

    def test_dep_func(self):
        # Test function deprecation
        dec = self.dep_func
        func = dec('foo')(func_no_doc)
        with pytest.deprecated_call():
            assert func() is None
        assert func.__doc__ == 'foo\n'
        func = dec('foo')(func_doc)
        with pytest.deprecated_call() as w:
            assert func(1) is None
            assert len(w) == 1
        assert func.__doc__ == 'A docstring\n\nfoo\n'
        func = dec('foo')(func_doc_long)
        with pytest.deprecated_call() as w:
            assert func(1, 2) is None
            assert len(w) == 1
>       assert (
            func.__doc__
            == f'A docstring\n   \n   foo\n   \n{indent(TESTSETUP, "   ", lambda x: True)}'
            f'   Some text\n{indent(TESTCLEANUP, "   ", lambda x: True)}'
        )
E       assert 'A docstring\n\nfoo\n\n\n\n.. testsetup::\n\n    >>> import pytest\n    >>> import warnings\n    >>> _suppress_warnings = pytest.deprecated_call()\n    >>> _ = _suppress_warnings.__enter__()\n\nSome text\n\n\n.. testcleanup::\n\n    >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)\n    >>> _ = _suppress_warnings.__exit__(None, None, None)\n\n' == 'A docstring\n   \n   foo\n   \n   \n   \n   .. testsetup::\n   \n       >>> import pytest\n       >>> import warnings\n       >>> _suppress_warnings = pytest.deprecated_call()\n       >>> _ = _suppress_warnings.__enter__()\n   \n   Some text\n   \n   \n   .. testcleanup::\n   \n       >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)\n       >>> _ = _suppress_warnings.__exit__(None, None, None)\n   \n'
E           A docstring
E         -    
E         -    foo
E         -    
E         -    
E         -    
E         + 
E         + foo
E         + 
E         + 
E         + 
E         -    .. testsetup::
E         ? ---
E         + .. testsetup::
E         -    
E         + 
E         -        >>> import pytest
E         ? ---
E         +     >>> import pytest
E         -        >>> import warnings
E         ? ---
E         +     >>> import warnings
E         -        >>> _suppress_warnings = pytest.deprecated_call()
E         ? ---
E         +     >>> _suppress_warnings = pytest.deprecated_call()
E         -        >>> _ = _suppress_warnings.__enter__()
E         ? ---
E         +     >>> _ = _suppress_warnings.__enter__()
E         -    
E         + 
E         -    Some text
E         ? ---
E         + Some text
E         -    
E         -    
E         + 
E         + 
E         -    .. testcleanup::
E         ? ---
E         + .. testcleanup::
E         -    
E         + 
E         -        >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)
E         ? ---
E         +     >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)
E         -        >>> _ = _suppress_warnings.__exit__(None, None, None)
E         ? ---
E         +     >>> _ = _suppress_warnings.__exit__(None, None, None)
E         -    
E         +

nibabel/tests/test_deprecator.py:95: AssertionError
_______________________ TestDeprecatorFunc.test_dep_func _______________________

self = <nibabel.tests.test_deprecator.TestDeprecatorFunc object at 0x7f7f64c8f7a0>

    def test_dep_func(self):
        # Test function deprecation
        dec = self.dep_func
        func = dec('foo')(func_no_doc)
        with pytest.deprecated_call():
            assert func() is None
        assert func.__doc__ == 'foo\n'
        func = dec('foo')(func_doc)
        with pytest.deprecated_call() as w:
            assert func(1) is None
            assert len(w) == 1
        assert func.__doc__ == 'A docstring\n\nfoo\n'
        func = dec('foo')(func_doc_long)
        with pytest.deprecated_call() as w:
            assert func(1, 2) is None
            assert len(w) == 1
>       assert (
            func.__doc__
            == f'A docstring\n   \n   foo\n   \n{indent(TESTSETUP, "   ", lambda x: True)}'
            f'   Some text\n{indent(TESTCLEANUP, "   ", lambda x: True)}'
        )
E       assert 'A docstring\n\nfoo\n\n\n\n.. testsetup::\n\n    >>> import pytest\n    >>> import warnings\n    >>> _suppress_warnings = pytest.deprecated_call()\n    >>> _ = _suppress_warnings.__enter__()\n\nSome text\n\n\n.. testcleanup::\n\n    >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)\n    >>> _ = _suppress_warnings.__exit__(None, None, None)\n\n' == 'A docstring\n   \n   foo\n   \n   \n   \n   .. testsetup::\n   \n       >>> import pytest\n       >>> import warnings\n       >>> _suppress_warnings = pytest.deprecated_call()\n       >>> _ = _suppress_warnings.__enter__()\n   \n   Some text\n   \n   \n   .. testcleanup::\n   \n       >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)\n       >>> _ = _suppress_warnings.__exit__(None, None, None)\n   \n'
E           A docstring
E         -    
E         -    foo
E         -    
E         -    
E         -    
E         + 
E         + foo
E         + 
E         + 
E         + 
E         -    .. testsetup::
E         ? ---
E         + .. testsetup::
E         -    
E         + 
E         -        >>> import pytest
E         ? ---
E         +     >>> import pytest
E         -        >>> import warnings
E         ? ---
E         +     >>> import warnings
E         -        >>> _suppress_warnings = pytest.deprecated_call()
E         ? ---
E         +     >>> _suppress_warnings = pytest.deprecated_call()
E         -        >>> _ = _suppress_warnings.__enter__()
E         ? ---
E         +     >>> _ = _suppress_warnings.__enter__()
E         -    
E         + 
E         -    Some text
E         ? ---
E         + Some text
E         -    
E         -    
E         + 
E         + 
E         -    .. testcleanup::
E         ? ---
E         + .. testcleanup::
E         -    
E         + 
E         -        >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)
E         ? ---
E         +     >>> warnings.warn("Avoid error if no doctests to run...", DeprecationWarning)
E         -        >>> _ = _suppress_warnings.__exit__(None, None, None)
E         ? ---
E         +     >>> _ = _suppress_warnings.__exit__(None, None, None)
E         -    
E         +

nibabel/tests/test_deprecator.py:95: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions