-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix numpy deprecation #114
base: master
Are you sure you want to change the base?
Fix numpy deprecation #114
Conversation
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 13 New issues |
|
Just tested this PR and test suite fail + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.5.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.5.0-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' --ignore tests/test_package_info.py
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0
plugins: mock-3.14.0, typeguard-4.2.1
collected 106 items / 1 error
========================================================================================== ERRORS ===========================================================================================
__________________________________________________________________________ ERROR collecting tests/test_beartype.py __________________________________________________________________________
tests/test_beartype.py:14: in <module>
def fun(_: NDArray[Shape["2, 2"], Float]) -> None:
/usr/lib/python3.10/site-packages/beartype/_decor/decorcache.py:77: in beartype
return beartype_object(obj, conf)
/usr/lib/python3.10/site-packages/beartype/_decor/decorcore.py:87: in beartype_object
_beartype_object_fatal(obj, conf=conf, **kwargs)
/usr/lib/python3.10/site-packages/beartype/_decor/decorcore.py:136: in _beartype_object_fatal
beartype_nontype(obj, **kwargs) # type: ignore[return-value]
/usr/lib/python3.10/site-packages/beartype/_decor/_decornontype.py:182: in beartype_nontype
return beartype_func(obj, **kwargs) # type: ignore[return-value]
/usr/lib/python3.10/site-packages/beartype/_decor/_decornontype.py:247: in beartype_func
func_wrapper_code = generate_code(bear_call)
/usr/lib/python3.10/site-packages/beartype/_decor/wrap/wrapmain.py:118: in generate_code
code_check_params = _code_check_args(bear_call)
/usr/lib/python3.10/site-packages/beartype/_decor/wrap/_wrapargs.py:334: in code_check_args
reraise_exception_placeholder(
/usr/lib/python3.10/site-packages/beartype/_util/error/utilerrraise.py:138: in reraise_exception_placeholder
raise exception.with_traceback(exception.__traceback__)
/usr/lib/python3.10/site-packages/beartype/_decor/wrap/_wrapargs.py:189: in code_check_args
hint = sanify_hint_root_func(
/usr/lib/python3.10/site-packages/beartype/_check/convert/convsanify.py:178: in sanify_hint_root_func
hint = reduce_hint(
/usr/lib/python3.10/site-packages/beartype/_check/convert/convreduce.py:201: in reduce_hint
hint = _reduce_hint_uncached(
/usr/lib/python3.10/site-packages/beartype/_check/convert/convreduce.py:280: in _reduce_hint_uncached
hint_sign = get_hint_pep_sign_or_none(hint)
/usr/lib/python3.10/site-packages/beartype/_util/cache/utilcachecall.py:250: in _callable_cached
raise exception
/usr/lib/python3.10/site-packages/beartype/_util/cache/utilcachecall.py:242: in _callable_cached
return_value = args_flat_to_return_value[args_flat] = func(
/usr/lib/python3.10/site-packages/beartype/_util/hint/pep/utilpepget.py:721: in get_hint_pep_sign_or_none
die_if_hint_pep604_inconsistent(hint)
/usr/lib/python3.10/site-packages/beartype/_util/hint/pep/proposal/utilpep604.py:73: in die_if_hint_pep604_inconsistent
raise BeartypeDecorHintPep604Exception(
E beartype.roar.BeartypeDecorHintPep604Exception: Type hint NDArray[Shape['2, 2'], Float] inconsistent with respect to repr() strings. Since @beartype requires consistency between type hints and repr() strings, this hint is unsupported by @beartype. Consider reporting this issue to the third-party developer implementing this hint: e.g.,
E >>> repr(NDArray[Shape['2, 2'], Float])
E NDArray[Shape['2, 2'], Float] # <-- this is fine
E >>> repr(NDArray[Shape['2, 2'], Float] | int)
E nptyping.ndarray.NDArray | int # <-- *THIS IS REALLY SUPER BAD*
E
E # Ideally, that output should instead resemble:
E >>> repr(NDArray[Shape['2, 2'], Float] | int)
E NDArray[Shape['2, 2'], Float] | int # <-- what @beartype wants!
===================================================================================== warnings summary ======================================================================================
../../../../../usr/lib64/python3.10/unittest/loader.py:66
/usr/lib64/python3.10/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py)
class TestLoader(object):
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
ERROR tests/test_beartype.py - beartype.roar.BeartypeDecorHintPep604Exception: Type hint NDArray[Shape['2, 2'], Float] inconsistent with respect to repr() strings. Since @beartype requires consistency between type h...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================ 1 warning, 1 error in 0.76s ================================================================================ |
After add tests/test_beartype.py to --ignore list many units fails because missing Here is pytest output:+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.5.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.5.0-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' --ignore tests/test_beartype.py --ignore tests/test_package_info.py
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0
plugins: mock-3.14.0, typeguard-4.2.1
collected 106 items
tests/pandas_/test_dataframe.py ......... [ 8%]
tests/pandas_/test_fork_sync.py . [ 9%]
tests/pandas_/test_mypy_dataframe.py FFF [ 12%]
tests/test_assert_isinstance.py ... [ 15%]
tests/test_base_meta_classes.py ......... [ 23%]
tests/test_help_texts.py ... [ 26%]
tests/test_lib_export.py . [ 27%]
tests/test_mypy.py FFFFFFFFFF. [ 37%]
tests/test_ndarray.py .......................... [ 62%]
tests/test_performance.py . [ 63%]
tests/test_pyright.py FF [ 65%]
tests/test_recarray.py ... [ 67%]
tests/test_shape.py ...... [ 73%]
tests/test_shape_expression.py ... [ 76%]
tests/test_structure.py ........ [ 83%]
tests/test_structure_expression.py .......... [ 93%]
tests/test_typeguard.py ..F. [ 97%]
tests/test_wheel.py FFF [100%]
========================================================================================= FAILURES ==========================================================================================
_______________________________________________________________________ MyPyDataFrameTest.test_mypy_accepts_dataframe _______________________________________________________________________
self = <tests.pandas_.test_mypy_dataframe.MyPyDataFrameTest testMethod=test_mypy_accepts_dataframe>
@skipUnless(7 < sys.version_info.minor, "MyPy does not work with DataFrame on 3.7")
def test_mypy_accepts_dataframe(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from nptyping import DataFrame, Structure as S
import pandas as pd
df: DataFrame[S["x: Int, y: Int"]] = pd.DataFrame({"x": [1], "y": [1]})
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E /tmp/tmp001bxzzy/test_file.py:2: error: Library stubs not installed for "pandas" [import-untyped]
E /tmp/tmp001bxzzy/test_file.py:2: note: Hint: "python3 -m pip install pandas-stubs"
E /tmp/tmp001bxzzy/test_file.py:2: note: (or run "mypy --install-types" to install all missing stub packages)
E /tmp/tmp001bxzzy/test_file.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 2 errors in 2 files (checked 1 source file)
tests/pandas_/test_mypy_dataframe.py:19: AssertionError
______________________________________________________ MyPyDataFrameTest.test_mypy_disapproves_dataframe_with_wrong_function_arguments ______________________________________________________
self = <tests.pandas_.test_mypy_dataframe.MyPyDataFrameTest testMethod=test_mypy_disapproves_dataframe_with_wrong_function_arguments>
@skipUnless(7 < sys.version_info.minor, "MyPy does not work with DataFrame on 3.7")
def test_mypy_disapproves_dataframe_with_wrong_function_arguments(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
import numpy as np
from nptyping import DataFrame, Structure as S
def func(_: DataFrame[S["x: Float, y: Float"]]) -> None:
...
func("Not an array...")
"""
)
> self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout)
E AssertionError: 'Argument 1 to "func" has incompatible type "str"' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]\nnptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"\nnptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nFound 1 error in 1 file (checked 1 source file)\n'
tests/pandas_/test_mypy_dataframe.py:38: AssertionError
__________________________________________________________________ MyPyDataFrameTest.test_mypy_knows_of_dataframe_methods ___________________________________________________________________
self = <tests.pandas_.test_mypy_dataframe.MyPyDataFrameTest testMethod=test_mypy_knows_of_dataframe_methods>
@skipUnless(7 < sys.version_info.minor, "MyPy does not work with DataFrame on 3.7")
def test_mypy_knows_of_dataframe_methods(self):
# If MyPy knows of some arbitrary DataFrame methods, we can assume that
# code completion works.
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import DataFrame
df: DataFrame[Any]
df.shape
df.dtypes
df.values
df.boxplot
df.filter
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/pandas_/test_mypy_dataframe.py:61: AssertionError
________________________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_any ________________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_ndarray_with_any>
def test_mypy_accepts_ndarray_with_any(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import NDArray
NDArray[Any, Any]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:17: AssertionError
_______________________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_shape _______________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_ndarray_with_shape>
def test_mypy_accepts_ndarray_with_shape(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import NDArray, Shape
NDArray[Shape["3, 3"], Any]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:30: AssertionError
_____________________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_structure _____________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_ndarray_with_structure>
def test_mypy_accepts_ndarray_with_structure(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import NDArray, RecArray, Structure
NDArray[Any, Structure["x: Float, y: Int"]]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:43: AssertionError
_________________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_function_arguments _________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_ndarrays_as_function_arguments>
def test_mypy_accepts_ndarrays_as_function_arguments(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
import numpy as np
from nptyping import NDArray, Shape
def func(_: NDArray[Shape["2, 2"], Any]) -> None:
...
func(np.array([1, 2])) # (Wrong shape though)
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:81: AssertionError
___________________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_variable_hints ___________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_ndarrays_as_variable_hints>
def test_mypy_accepts_ndarrays_as_variable_hints(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
import numpy as np
from nptyping import NDArray
arr: NDArray[Any, Any] = np.array([1, 2, 3])
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:95: AssertionError
_________________________________________________________________________ MyPyTest.test_mypy_accepts_nptyping_types _________________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_nptyping_types>
def test_mypy_accepts_nptyping_types(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
import numpy as np
import numpy.typing as npt
from nptyping import (
NDArray,
Number,
Bool,
Object,
Datetime64,
Integer,
SignedInteger,
Int8,
Int16,
Int32,
Int64,
Byte,
Short,
IntC,
IntP,
Int,
LongLong,
Timedelta64,
UnsignedInteger,
UInt8,
UInt16,
UInt32,
UInt64,
UByte,
UShort,
UIntC,
UIntP,
UInt,
ULongLong,
Inexact,
Floating,
Float16,
Float32,
Float64,
Half,
Single,
Double,
Float,
LongDouble,
LongFloat,
ComplexFloating,
Complex64,
Complex128,
CSingle,
SingleComplex,
CDouble,
Complex,
CFloat,
CLongDouble,
CLongFloat,
LongComplex,
Flexible,
Void,
Character,
Bytes,
String,
Unicode,
)
NDArray[Any, Number]
NDArray[Any, Bool]
NDArray[Any, Object]
NDArray[Any, Datetime64]
NDArray[Any, Integer]
NDArray[Any, SignedInteger]
NDArray[Any, Int8]
NDArray[Any, Int16]
NDArray[Any, Int32]
NDArray[Any, Int64]
NDArray[Any, Byte]
NDArray[Any, Short]
NDArray[Any, IntC]
NDArray[Any, IntP]
NDArray[Any, Int]
NDArray[Any, LongLong]
NDArray[Any, Timedelta64]
NDArray[Any, UnsignedInteger]
NDArray[Any, UInt8]
NDArray[Any, UInt16]
NDArray[Any, UInt32]
NDArray[Any, UInt64]
NDArray[Any, UByte]
NDArray[Any, UShort]
NDArray[Any, UIntC]
NDArray[Any, UIntP]
NDArray[Any, UInt]
NDArray[Any, ULongLong]
NDArray[Any, Inexact]
NDArray[Any, Floating]
NDArray[Any, Float16]
NDArray[Any, Float32]
NDArray[Any, Float64]
NDArray[Any, Half]
NDArray[Any, Single]
NDArray[Any, Double]
NDArray[Any, Float]
NDArray[Any, LongDouble]
NDArray[Any, LongFloat]
NDArray[Any, ComplexFloating]
NDArray[Any, Complex64]
NDArray[Any, Complex128]
NDArray[Any, CSingle]
NDArray[Any, SingleComplex]
NDArray[Any, CDouble]
NDArray[Any, Complex]
NDArray[Any, CFloat]
NDArray[Any, CLongDouble]
NDArray[Any, CLongFloat]
NDArray[Any, LongComplex]
NDArray[Any, Flexible]
NDArray[Any, Void]
NDArray[Any, Character]
NDArray[Any, Bytes]
NDArray[Any, String]
NDArray[Any, Unicode]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:289: AssertionError
__________________________________________________________________________ MyPyTest.test_mypy_accepts_numpy_types ___________________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_numpy_types>
def test_mypy_accepts_numpy_types(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import NDArray
import numpy as np
NDArray[Any, np.dtype[np.int_]]
NDArray[Any, np.dtype[np.float_]]
NDArray[Any, np.dtype[np.uint8]]
NDArray[Any, np.dtype[np.bool_]]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:125: AssertionError
____________________________________________________________________ MyPyTest.test_mypy_accepts_recarray_with_structure _____________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_accepts_recarray_with_structure>
def test_mypy_accepts_recarray_with_structure(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import RecArray, Structure
RecArray[Any, Structure["x: Float, y: Int"]]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:108: AssertionError
___________________________________________________________ MyPyTest.test_mypy_disapproves_ndarray_with_wrong_function_arguments ____________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_disapproves_ndarray_with_wrong_function_arguments>
def test_mypy_disapproves_ndarray_with_wrong_function_arguments(self):
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
import numpy as np
from nptyping import NDArray, Shape
def func(_: NDArray[Shape["2, 2"], Any]) -> None:
...
func("Not an array...")
"""
)
self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout)
self.assertIn('expected "ndarray[Any, Any]"', stdout)
> self.assertIn("Found 1 error in 1 file", stdout)
E AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]\nnptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"\nnptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\n/tmp/tmp6slfx5r8/test_file.py:10: error: Argument 1 to "func" has incompatible type "str"; expected "ndarray[Any, Any]" [arg-type]\nFound 2 errors in 2 files (checked 1 source file)\n'
tests/test_mypy.py:63: AssertionError
________________________________________________________________________ MyPyTest.test_mypy_knows_of_ndarray_methods ________________________________________________________________________
self = <tests.test_mypy.MyPyTest testMethod=test_mypy_knows_of_ndarray_methods>
def test_mypy_knows_of_ndarray_methods(self):
# If MyPy knows of some arbitrary ndarray methods, we can assume that
# code completion works.
exit_code, stdout, stderr = check_mypy_on_code(
"""
from typing import Any
from nptyping import NDArray
arr: NDArray[Any, Any]
arr.shape
arr.size
arr.sort
arr.squeeze
arr.transpose
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
E nptyping/pandas_/dataframe.pyi:25: note: Hint: "python3 -m pip install pandas-stubs"
E nptyping/pandas_/dataframe.pyi:25: note: (or run "mypy --install-types" to install all missing stub packages)
E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
E Found 1 error in 1 file (checked 1 source file)
tests/test_mypy.py:162: AssertionError
_____________________________________________________________________ PyrightTest.test_pyright_accepts_array_with_shape _____________________________________________________________________
self = <tests.test_pyright.PyrightTest testMethod=test_pyright_accepts_array_with_shape>
def test_pyright_accepts_array_with_shape(self):
exit_code, stdout, sterr = _check_pyright_on_code(
"""
from typing import Any
from nptyping import NDArray, Shape
NDArray[Shape["*, ..."], Any]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 :
tests/test_pyright.py:36: AssertionError
___________________________________________________________________ PyrightTest.test_pyright_accepts_array_with_structure ___________________________________________________________________
self = <tests.test_pyright.PyrightTest testMethod=test_pyright_accepts_array_with_structure>
def test_pyright_accepts_array_with_structure(self):
exit_code, stdout, sterr = _check_pyright_on_code(
"""
from typing import Any
from nptyping import NDArray, Structure
NDArray[Any, Structure["x: Int, y: Float"]]
"""
)
> self.assertEqual(0, exit_code, stdout)
E AssertionError: 0 != 1 :
tests/test_pyright.py:48: AssertionError
________________________________________________________________________________ TypeguardTest.test_success _________________________________________________________________________________
self = <tests.test_typeguard.TypeguardTest testMethod=test_success>
def test_success(self):
> fun(np.random.randn(2, 2))
tests/test_typeguard.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_typeguard.py:14: in fun
def fun(_: NDArray[Shape["2, 2"], Float]) -> None:
nptyping/base_meta_classes.py:145: in __getitem__
args = cls._get_item(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = Shape['*, ...'], item = (2, 2)
def _get_item(cls, item: Any) -> Tuple[Any, ...]:
if not isinstance(item, str):
> raise InvalidArgumentsError(
f"Unexpected argument of type {type(item)}, expecting a string."
)
E nptyping.error.InvalidArgumentsError: Unexpected argument of type <class 'tuple'>, expecting a string.
nptyping/base_meta_classes.py:213: InvalidArgumentsError
__________________________________________________________________________ WheelTest.test_wheel_is_built_correctly __________________________________________________________________________
self = <tests.test_wheel.WheelTest testMethod=test_wheel_is_built_correctly>
def test_wheel_is_built_correctly(self):
with working_dir(_ROOT):
> subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True)
tests/test_wheel.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/subprocess.py:421: in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True, popenargs = ('/usr/bin/python3 -m invoke wheel',), kwargs = {'shell': True, 'stdout': -1}
process = <Popen: returncode: 127 args: '/usr/bin/python3 -m invoke wheel'>, stdout = b'Installing dependencies into: .venv3.10.14\n', stderr = None, retcode = 127
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit status 127.
/usr/lib64/python3.10/subprocess.py:526: CalledProcessError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
/bin/bash: line 1: .venv3.10.14/bin/python: No such file or directory
___________________________________________________________________________ WheelTest.test_wheel_can_be_installed ___________________________________________________________________________
self = <tests.test_wheel.WheelTest testMethod=test_wheel_can_be_installed>
def test_wheel_can_be_installed(self):
with working_dir(Path(self.temp_dir.name)):
venv.create(_VENV_NAME, with_pip=False)
# For some reason, with_pip=True fails, so we do it separately.
> subprocess.check_output(
f"{self.py} -m ensurepip --upgrade --default-pip", shell=True
)
tests/test_wheel.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/subprocess.py:421: in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True, popenargs = ('/tmp/tmphbbzef22/test_venv/bin/python -m ensurepip --upgrade --default-pip',)
kwargs = {'shell': True, 'stdout': -1}, process = <Popen: returncode: 1 args: '/tmp/tmphbbzef22/test_venv/bin/python -m ensure...>, stdout = b'', stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '/tmp/tmphbbzef22/test_venv/bin/python -m ensurepip --upgrade --default-pip' returned non-zero exit status 1.
/usr/lib64/python3.10/subprocess.py:526: CalledProcessError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib64/python3.10/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/usr/lib64/python3.10/ensurepip/__init__.py", line 287, in _main
return _bootstrap(
File "/usr/lib64/python3.10/ensurepip/__init__.py", line 179, in _bootstrap
whl = resources.read_binary(_bundled, wheel_name)
File "/usr/lib64/python3.10/importlib/resources.py", line 88, in read_binary
with open_binary(package, resource) as fp:
File "/usr/lib64/python3.10/importlib/resources.py", line 46, in open_binary
return reader.open_resource(resource)
File "/usr/lib64/python3.10/importlib/abc.py", line 433, in open_resource
return self.files().joinpath(resource).open('rb')
File "/usr/lib64/python3.10/pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.10/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl'
____________________________________________________________________________ WheelTest.test_basic_nptyping_code _____________________________________________________________________________
self = <tests.test_wheel.WheelTest testMethod=test_basic_nptyping_code>
def test_basic_nptyping_code(self):
code = (
"from nptyping import NDArray, Shape, Int; "
"import numpy as np; "
"print(isinstance(np.array([[1, 2], [3, 4]]), NDArray[Shape['2, 2'], Int]))"
)
> output = subprocess.check_output(f'{self.py} -c "{code}"', shell=True)
tests/test_wheel.py:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/subprocess.py:421: in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = ('/tmp/tmphbbzef22/test_venv/bin/python -c "from nptyping import NDArray, Shape, Int; import numpy as np; print(isinstance(np.array([[1, 2], [3, 4]]), NDArray[Shape[\'2, 2\'], Int]))"',)
kwargs = {'shell': True, 'stdout': -1}, process = <Popen: returncode: 1 args: '/tmp/tmphbbzef22/test_venv/bin/python -c "from ...>, stdout = b'', stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '/tmp/tmphbbzef22/test_venv/bin/python -c "from nptyping import NDArray, Shape, Int; import numpy as np; print(isinstance(np.array([[1, 2], [3, 4]]), NDArray[Shape['2, 2'], Int]))"' returned non-zero exit status 1.
/usr/lib64/python3.10/subprocess.py:526: CalledProcessError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/__init__.py", line 32, in <module>
from nptyping.ndarray import NDArray
File "/home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/ndarray.py", line 28, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
===================================================================================== warnings summary ======================================================================================
../../../../../usr/lib64/python3.10/unittest/loader.py:66
/usr/lib64/python3.10/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py)
class TestLoader(object):
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_accepts_dataframe - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_disapproves_dataframe_with_wrong_function_arguments - AssertionError: 'Argument 1 to "func" has incompatible type "str"' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]\nn...
FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_knows_of_dataframe_methods - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_any - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_shape - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_structure - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_function_arguments - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_variable_hints - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_nptyping_types - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_numpy_types - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_recarray_with_structure - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_mypy.py::MyPyTest::test_mypy_disapproves_ndarray_with_wrong_function_arguments - AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]\nnptyping/pandas_/dataframe...
FAILED tests/test_mypy.py::MyPyTest::test_mypy_knows_of_ndarray_methods - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Library stubs not installed for "pandas" [import-untyped]
FAILED tests/test_pyright.py::PyrightTest::test_pyright_accepts_array_with_shape - AssertionError: 0 != 1 :
FAILED tests/test_pyright.py::PyrightTest::test_pyright_accepts_array_with_structure - AssertionError: 0 != 1 :
FAILED tests/test_typeguard.py::TypeguardTest::test_success - nptyping.error.InvalidArgumentsError: Unexpected argument of type <class 'tuple'>, expecting a string.
FAILED tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly - subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit status 127.
FAILED tests/test_wheel.py::WheelTest::test_wheel_can_be_installed - subprocess.CalledProcessError: Command '/tmp/tmphbbzef22/test_venv/bin/python -m ensurepip --upgrade --default-pip' returned non-zero exit status 1.
FAILED tests/test_wheel.py::WheelTest::test_basic_nptyping_code - subprocess.CalledProcessError: Command '/tmp/tmphbbzef22/test_venv/bin/python -c "from nptyping import NDArray, Shape, Int; import numpy as np; print(isinstance(np.array([[1, 2], [3, 4...
========================================================================= 19 failed, 87 passed, 1 warning in 41.03s ========================================================================= |
Importing nptyping with numpy>=2.0.0 now raises exceptions instead of warnings for deprecated dtypes. ramonhagenaars/nptyping#114 ramonhagenaars/nptyping#113 ramonhagenaars/nptyping#102
Now that numpy2.0.0 is out, all those numpy deprecations are now raising exceptions, so it would be great if this PR could be merged as a first step toward compatibility with the new numpy. On my fork I made a few additional changes that numpy recommends via their ruff rule, so we could PR my fork as well: jasper-tms@efc78eb |
Attempt to fix:
=nptyping-2.5.0
(Name "np.bool8" is not defined
) #113Which error out because of deprecation of
int0
,object0
, etc. types