Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MAINT: Hide decorator from pytest traceback#28510

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
charris merged 1 commit intonumpy:maintenance/2.2.xfromcharris:backport-28211
Mar 14, 2025

Conversation

@charris
Copy link
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 equalEE       (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 equalEE       (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

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 equalEE       (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```
@charrischarris added this to the2.2.4 release milestoneMar 14, 2025
@charrischarris added the 08 - BackportUsed to tag backport PRs labelMar 14, 2025
@charrischarris merged commit03d8f36 intonumpy:maintenance/2.2.xMar 14, 2025
70 checks passed
@charrischarris deleted the backport-28211 branchMarch 14, 2025 19:56
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

03 - Maintenance08 - BackportUsed to tag backport PRs

Projects

None yet

Milestone

2.2.4 release

Development

Successfully merging this pull request may close these issues.

2 participants

@charris@hmaarrfk

[8]ページ先頭

©2009-2025 Movatter.jp