GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MAINT: Hide decorator from pytest traceback by charris · Pull Request #28510 · numpy/numpy

Conversation

@charris

@charris charris commented Mar 14, 2025

Copy link
Copy Markdown
Member

Backport of #28211.

Currently it points the user to the internal numpy function

kwargs = {'strict': False}, old_name = 'y', new_name = 'desired'

    @functools.wraps(fun)
    def wrapper(*args, **kwargs):
        for old_name, new_name in zip(old_names, new_names):
            if old_name in kwargs:
                if dep_version:
                    end_version = dep_version.split('.')
                    end_version[1] = str(int(end_version[1]) + 2)
                    end_version = '.'.join(end_version)
                    msg = (f"Use of keyword argument `{old_name}` is "
                           f"deprecated and replaced by `{new_name}`. "
                           f"Support for `{old_name}` will be removed "
                           f"in NumPy {end_version}.")
                    warnings.warn(msg, DeprecationWarning, stacklevel=2)
                if new_name in kwargs:
                    msg = (f"{fun.__name__}() got multiple values for "
                           f"argument now known as `{new_name}`")
                    raise TypeError(msg)
                kwargs[new_name] = kwargs.pop(old_name)
>       return fun(*args, **kwargs)
E       AssertionError:
E       Arrays are not equal
E
E       (shapes (2, 2, 200, 200), (2, 2, 800, 800) mismatch)
E        ACTUAL: array([[[[0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],...
E        DESIRED: array([[[[0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],...

../../miniforge3/envs/dev/lib/python3.10/site-packages/numpy/_utils/__init__.py:85: AssertionError

Whit this PR:

>       np.testing.assert_equal(data, other)
E       AssertionError:
E       Arrays are not equal
E
E       (shapes (2, 2, 200, 200), (2, 2, 800, 800) mismatch)
E        ACTUAL: array([[[[0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],...
E        DESIRED: array([[[[0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],...

tests/my_test.py:190: AssertionError

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hmaarrfk @charris
MAINT: Hide decorator from pytest traceback
85f2711
Currently it points the user to the internal numpy function

```
kwargs = {'strict': False}, old_name = 'y', new_name = 'desired'

    @functools.wraps(fun)
    def wrapper(*args, **kwargs):
        for old_name, new_name in zip(old_names, new_names):
            if old_name in kwargs:
                if dep_version:
                    end_version = dep_version.split('.')
                    end_version[1] = str(int(end_version[1]) + 2)
                    end_version = '.'.join(end_version)
                    msg = (f"Use of keyword argument `{old_name}` is "
                           f"deprecated and replaced by `{new_name}`. "
                           f"Support for `{old_name}` will be removed "
                           f"in NumPy {end_version}.")
                    warnings.warn(msg, DeprecationWarning, stacklevel=2)
                if new_name in kwargs:
                    msg = (f"{fun.__name__}() got multiple values for "
                           f"argument now known as `{new_name}`")
                    raise TypeError(msg)
                kwargs[new_name] = kwargs.pop(old_name)
>       return fun(*args, **kwargs)
E       AssertionError:
E       Arrays are not equal
E
E       (shapes (2, 2, 200, 200), (2, 2, 800, 800) mismatch)
E        ACTUAL: array([[[[0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],...
E        DESIRED: array([[[[0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],
E                [0, 0, 0, ..., 0, 0, 0],...

../../miniforge3/envs/dev/lib/python3.10/site-packages/numpy/_utils/__init__.py:85: AssertionError
```
@charris charris added the 03 - Maintenance label Mar 14, 2025
@charris charris added this to the 2.2.4 release milestone Mar 14, 2025
@charris charris added the 08 - Backport Used to tag backport PRs label Mar 14, 2025
@charris
charris merged commit 03d8f36 into numpy:maintenance/2.2.x Mar 14, 2025
@charris
charris deleted the backport-28211 branch March 14, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

03 - Maintenance 08 - Backport Used to tag backport PRs

Projects

None yet

Milestone

2.2.4 release

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@charris @hmaarrfk
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.