From a19c844c354fb1d3d089233de1bafdecbdf869a2 Mon Sep 17 00:00:00 2001 From: Lukas Bentkamp Date: Sat, 12 Oct 2019 23:52:25 +0200 Subject: [PATCH 1/3] CLN: fix mypy errors in pandas/tests/extension/test_numpy.py #28926 --- pandas/tests/extension/base/ops.py | 9 +++++---- setup.cfg | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pandas/tests/extension/base/ops.py b/pandas/tests/extension/base/ops.py index e35464964f432..cee45943e0976 100644 --- a/pandas/tests/extension/base/ops.py +++ b/pandas/tests/extension/base/ops.py @@ -1,4 +1,5 @@ import operator +from typing import Type, Union import pytest @@ -61,10 +62,10 @@ class BaseArithmeticOpsTests(BaseOpsUtil): * divmod_exc = TypeError """ - series_scalar_exc = TypeError - frame_scalar_exc = TypeError - series_array_exc = TypeError - divmod_exc = TypeError + series_scalar_exc = TypeError # type: Union[Type[Exception], None] + frame_scalar_exc = TypeError # type: Union[Type[Exception], None] + series_array_exc = TypeError # type: Union[Type[Exception], None] + divmod_exc = TypeError # type: Union[Type[Exception], None] def test_arith_series_with_scalar(self, data, all_arithmetic_operators): # series & scalar diff --git a/setup.cfg b/setup.cfg index 9c841b76761f5..4b14089ea9a63 100644 --- a/setup.cfg +++ b/setup.cfg @@ -166,9 +166,6 @@ ignore_errors=True [mypy-pandas.tests.extension.json.test_json] ignore_errors=True -[mypy-pandas.tests.extension.test_numpy] -ignore_errors=True - [mypy-pandas.tests.extension.test_sparse] ignore_errors=True From 28b71205821a5786c9e69aa241f95282f0036724 Mon Sep 17 00:00:00 2001 From: Lukas Bentkamp Date: Sun, 13 Oct 2019 12:58:42 +0200 Subject: [PATCH 2/3] Applied suggestions, PR also fixes errors in test_sparse.py --- pandas/tests/extension/base/ops.py | 8 ++++---- setup.cfg | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pandas/tests/extension/base/ops.py b/pandas/tests/extension/base/ops.py index cee45943e0976..162a0e3b3058d 100644 --- a/pandas/tests/extension/base/ops.py +++ b/pandas/tests/extension/base/ops.py @@ -62,10 +62,10 @@ class BaseArithmeticOpsTests(BaseOpsUtil): * divmod_exc = TypeError """ - series_scalar_exc = TypeError # type: Union[Type[Exception], None] - frame_scalar_exc = TypeError # type: Union[Type[Exception], None] - series_array_exc = TypeError # type: Union[Type[Exception], None] - divmod_exc = TypeError # type: Union[Type[Exception], None] + series_scalar_exc = TypeError # type: Optional[Type[TypeError]] + frame_scalar_exc = TypeError # type: Optional[Type[TypeError]] + series_array_exc = TypeError # type: Optional[Type[TypeError]] + divmod_exc = TypeError # type: Optional[Type[TypeError]] def test_arith_series_with_scalar(self, data, all_arithmetic_operators): # series & scalar diff --git a/setup.cfg b/setup.cfg index 4b14089ea9a63..9af7215b1dc56 100644 --- a/setup.cfg +++ b/setup.cfg @@ -166,9 +166,6 @@ ignore_errors=True [mypy-pandas.tests.extension.json.test_json] ignore_errors=True -[mypy-pandas.tests.extension.test_sparse] -ignore_errors=True - [mypy-pandas.tests.frame.test_constructors] ignore_errors=True From 008fe48c8eae07dc9916aa003cdefec880e6d57b Mon Sep 17 00:00:00 2001 From: Lukas Bentkamp Date: Sun, 13 Oct 2019 13:09:24 +0200 Subject: [PATCH 3/3] Adjusted imports --- pandas/tests/extension/base/ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/extension/base/ops.py b/pandas/tests/extension/base/ops.py index 162a0e3b3058d..e968962caf0b7 100644 --- a/pandas/tests/extension/base/ops.py +++ b/pandas/tests/extension/base/ops.py @@ -1,5 +1,5 @@ import operator -from typing import Type, Union +from typing import Optional, Type import pytest