Issue 1:
Describe the issue:

Running numpy.test() resulted in 2 failures.

FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__]
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__]

Reproduce the code example:

import numpy as np
np.test()

Error message:

NumPy version 1.21.4
NumPy relaxed strides checking option: True
NumPy CPU features: SSE SSE2 SSE3 SSSE3* SSE41* POPCNT* SSE42* AVX* F16C* FMA3* AVX2* AVX512F* AVX512CD* AVX512_KNL? AVX512_KNM? AVX512_SKX* AVX512_CLX* AVX512_CNL? AVX512_ICL?
...
=================================== FAILURES ===================================
___________________ TestGenericAlias.test_getattr[__copy__] ____________________

self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c02850>
name = '__copy__'

@pytest.mark.parametrize("name", GETATTR_NAMES)
def test_getattr(self, name: str) -> None:
"""Test that `getattr` wraps around the underlying type,
aka ``__origin__``.

"""
value = getattr(NDArray, name)
value_ref1 = getattr(np.ndarray, name)

if sys.version_info >= (3, 9):
> value_ref2 = getattr(NDArray_ref, name)
E AttributeError: 'types.GenericAlias' object has no attribute '__copy__'

name = '__copy__'
self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c02850>
value = <method '__copy__' of 'numpy.ndarray' objects>
value_ref1 = <method '__copy__' of 'numpy.ndarray' objects>

../../python/gcc/3.9.9/lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
_________________ TestGenericAlias.test_getattr[__deepcopy__] __________________

self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c10ca0>
name = '__deepcopy__'

@pytest.mark.parametrize("name", GETATTR_NAMES)
def test_getattr(self, name: str) -> None:
"""Test that `getattr` wraps around the underlying type,
aka ``__origin__``.

"""
value = getattr(NDArray, name)
value_ref1 = getattr(np.ndarray, name)

if sys.version_info >= (3, 9):
> value_ref2 = getattr(NDArray_ref, name)
E AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'

name = '__deepcopy__'
self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c10ca0>
value = <method '__deepcopy__' of 'numpy.ndarray' objects>
value_ref1 = <method '__deepcopy__' of 'numpy.ndarray' objects>

../../python/gcc/3.9.9/lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
=========================== short test summary info ============================
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__]
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__]
2 failed, 15549 passed, 60 skipped, 1253 deselected, 19 xfailed, 3 xpassed in 160.85s (0:02:40)

NumPy/Python version information:

Python 3.9.9 (compiled with GCC 9.2, OpenBLAS 0.3.12)

numpy 1.21.4 built from source

Issue 2:
Describe the issue:

Running numpy.test() results in attribute error

Reproduce the code example:

import numpy as np

np.test()

Error message:

============== FAILURES =====================================================================================================
_____________________________________________________________________________________ TestGenericAlias.test_getattr[__copy__] _____________________________________________________________________________________

self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f47493442b0>, name = '__copy__'

@pytest.mark.parametrize("name", GETATTR_NAMES)
def test_getattr(self, name: str) -> None:
"""Test that `getattr` wraps around the underlying type,
aka ``__origin__``.

"""
value = getattr(NDArray, name)
value_ref1 = getattr(np.ndarray, name)

if sys.version_info >= (3, 9):
> value_ref2 = getattr(NDArray_ref, name)
E AttributeError: 'types.GenericAlias' object has no attribute '__copy__'

name = '__copy__'
self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f47493442b0>
value = <method '__copy__' of 'numpy.ndarray' objects>
value_ref1 = <method '__copy__' of 'numpy.ndarray' objects>

lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
___________________________________________________________________________________ TestGenericAlias.test_getattr[__deepcopy__] ___________________________________________________________________________________

self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f474935f340>, name = '__deepcopy__'

@pytest.mark.parametrize("name", GETATTR_NAMES)
def test_getattr(self, name: str) -> None:
"""Test that `getattr` wraps around the underlying type,
aka ``__origin__``.

"""
value = getattr(NDArray, name)
value_ref1 = getattr(np.ndarray, name)

if sys.version_info >= (3, 9):
> value_ref2 = getattr(NDArray_ref, name)
E AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'

name = '__deepcopy__'
self = <numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f474935f340>
value = <method '__deepcopy__' of 'numpy.ndarray' objects>
value_ref1 = <method '__deepcopy__' of 'numpy.ndarray' objects>

lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
============================================================================================= short test summary info =============================================================================================
FAILED lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__] - AttributeError: 'types.GenericAlias' object has no attribute '__copy__'
FAILED lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__] - AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'
2 failed, 14972 passed, 633 skipped, 1253 deselected, 19 xfailed, 3 xpassed in 137.21s (0:02:17)
False

NumPy/Python version information:

numpy 1.21.4 and 1.21.2 (didn't test numpy 1.21.3)

python 3.9.9

tests for the same versions of numpy did not return any error for python 3.9.7

OS Ubuntu 20.04, pythons and numpy compiled from source