From 778610d79db30ec09067518676b78be7563eb121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Wo=C5=9B?= Date: Sun, 28 Oct 2018 14:38:50 +0100 Subject: [PATCH] Fix import format at pandas/tests/extension directory (#23365) --- pandas/tests/extension/arrow/bool.py | 3 ++- pandas/tests/extension/arrow/test_bool.py | 5 ++-- pandas/tests/extension/base/dtype.py | 1 + pandas/tests/extension/base/getitem.py | 2 +- pandas/tests/extension/base/groupby.py | 3 ++- pandas/tests/extension/base/methods.py | 2 +- pandas/tests/extension/base/ops.py | 5 ++-- pandas/tests/extension/base/reduce.py | 5 +++- pandas/tests/extension/base/reshaping.py | 2 +- pandas/tests/extension/base/setitem.py | 1 + pandas/tests/extension/decimal/array.py | 3 +-- .../tests/extension/decimal/test_decimal.py | 10 ++++---- pandas/tests/extension/json/array.py | 2 +- pandas/tests/extension/json/test_json.py | 2 +- pandas/tests/extension/test_categorical.py | 8 +++--- pandas/tests/extension/test_common.py | 2 +- pandas/tests/extension/test_external_block.py | 6 ++--- pandas/tests/extension/test_integer.py | 12 ++++----- pandas/tests/extension/test_interval.py | 4 +-- pandas/tests/extension/test_sparse.py | 6 ++--- setup.cfg | 25 ++----------------- 21 files changed, 47 insertions(+), 62 deletions(-) diff --git a/pandas/tests/extension/arrow/bool.py b/pandas/tests/extension/arrow/bool.py index d595879e3cb7db..e6f997b01aad20 100644 --- a/pandas/tests/extension/arrow/bool.py +++ b/pandas/tests/extension/arrow/bool.py @@ -10,9 +10,10 @@ import numpy as np import pyarrow as pa + import pandas as pd from pandas.api.extensions import ( - ExtensionDtype, ExtensionArray, take, register_extension_dtype + ExtensionArray, ExtensionDtype, register_extension_dtype, take ) diff --git a/pandas/tests/extension/arrow/test_bool.py b/pandas/tests/extension/arrow/test_bool.py index 5a01533cfc5644..f259e66e6cc766 100644 --- a/pandas/tests/extension/arrow/test_bool.py +++ b/pandas/tests/extension/arrow/test_bool.py @@ -1,12 +1,13 @@ import numpy as np import pytest + import pandas as pd import pandas.util.testing as tm from pandas.tests.extension import base pytest.importorskip('pyarrow', minversion="0.10.0") -from .bool import ArrowBoolDtype, ArrowBoolArray +from .bool import ArrowBoolArray, ArrowBoolDtype @pytest.fixture @@ -17,7 +18,7 @@ def dtype(): @pytest.fixture def data(): return ArrowBoolArray.from_scalars(np.random.randint(0, 2, size=100, - dtype=bool)) + dtype=bool)) @pytest.fixture diff --git a/pandas/tests/extension/base/dtype.py b/pandas/tests/extension/base/dtype.py index d5cf9571e36222..e9d1f183812ccd 100644 --- a/pandas/tests/extension/base/dtype.py +++ b/pandas/tests/extension/base/dtype.py @@ -1,6 +1,7 @@ import warnings import numpy as np + import pandas as pd from .base import BaseExtensionTests diff --git a/pandas/tests/extension/base/getitem.py b/pandas/tests/extension/base/getitem.py index 22b21102fa4aee..00bb3b5d4eec25 100644 --- a/pandas/tests/extension/base/getitem.py +++ b/pandas/tests/extension/base/getitem.py @@ -1,5 +1,5 @@ -import pytest import numpy as np +import pytest import pandas as pd import pandas.util.testing as tm diff --git a/pandas/tests/extension/base/groupby.py b/pandas/tests/extension/base/groupby.py index 52c635d286df6e..dd406ca0cd5ed8 100644 --- a/pandas/tests/extension/base/groupby.py +++ b/pandas/tests/extension/base/groupby.py @@ -1,7 +1,8 @@ import pytest -import pandas.util.testing as tm import pandas as pd +import pandas.util.testing as tm + from .base import BaseExtensionTests diff --git a/pandas/tests/extension/base/methods.py b/pandas/tests/extension/base/methods.py index dce91d5a9ca9c0..f7649415f24716 100644 --- a/pandas/tests/extension/base/methods.py +++ b/pandas/tests/extension/base/methods.py @@ -1,5 +1,5 @@ -import pytest import numpy as np +import pytest import pandas as pd import pandas.util.testing as tm diff --git a/pandas/tests/extension/base/ops.py b/pandas/tests/extension/base/ops.py index 7baa6284e398f9..2161214190be06 100644 --- a/pandas/tests/extension/base/ops.py +++ b/pandas/tests/extension/base/ops.py @@ -1,9 +1,10 @@ -import pytest - import operator +import pytest + import pandas as pd from pandas.core import ops + from .base import BaseExtensionTests diff --git a/pandas/tests/extension/base/reduce.py b/pandas/tests/extension/base/reduce.py index 4f6c7988314c02..c4b70f20132656 100644 --- a/pandas/tests/extension/base/reduce.py +++ b/pandas/tests/extension/base/reduce.py @@ -1,7 +1,10 @@ import warnings + import pytest -import pandas.util.testing as tm + import pandas as pd +import pandas.util.testing as tm + from .base import BaseExtensionTests diff --git a/pandas/tests/extension/base/reshaping.py b/pandas/tests/extension/base/reshaping.py index 7f13c2cd673731..446912b66bf339 100644 --- a/pandas/tests/extension/base/reshaping.py +++ b/pandas/tests/extension/base/reshaping.py @@ -1,5 +1,5 @@ -import pytest import numpy as np +import pytest import pandas as pd from pandas.core.internals import ExtensionBlock diff --git a/pandas/tests/extension/base/setitem.py b/pandas/tests/extension/base/setitem.py index 029a77acb121fa..72316b5b7eb919 100644 --- a/pandas/tests/extension/base/setitem.py +++ b/pandas/tests/extension/base/setitem.py @@ -5,6 +5,7 @@ import pandas as pd import pandas.util.testing as tm + from .base import BaseExtensionTests diff --git a/pandas/tests/extension/decimal/array.py b/pandas/tests/extension/decimal/array.py index fe07aae61c5e29..e47b8049ae65c1 100644 --- a/pandas/tests/extension/decimal/array.py +++ b/pandas/tests/extension/decimal/array.py @@ -6,8 +6,7 @@ import numpy as np import pandas as pd -from pandas.core.arrays import (ExtensionArray, - ExtensionScalarOpsMixin) +from pandas.core.arrays import ExtensionArray, ExtensionScalarOpsMixin from pandas.core.dtypes.base import ExtensionDtype diff --git a/pandas/tests/extension/decimal/test_decimal.py b/pandas/tests/extension/decimal/test_decimal.py index be1c61166e4b13..59e77c3f0f3f3f 100644 --- a/pandas/tests/extension/decimal/test_decimal.py +++ b/pandas/tests/extension/decimal/test_decimal.py @@ -1,15 +1,15 @@ -import operator import decimal +import operator import numpy as np -import pandas as pd -from pandas import compat -import pandas.util.testing as tm import pytest +import pandas as pd +import pandas.util.testing as tm +from pandas import compat from pandas.tests.extension import base -from .array import DecimalDtype, DecimalArray, make_data, to_decimal +from .array import DecimalArray, DecimalDtype, make_data, to_decimal @pytest.fixture diff --git a/pandas/tests/extension/json/array.py b/pandas/tests/extension/json/array.py index 5c63e50c3eaaa8..75b0f6b02edadb 100644 --- a/pandas/tests/extension/json/array.py +++ b/pandas/tests/extension/json/array.py @@ -20,8 +20,8 @@ import numpy as np from pandas import compat -from pandas.core.dtypes.base import ExtensionDtype from pandas.core.arrays import ExtensionArray +from pandas.core.dtypes.base import ExtensionDtype class JSONDtype(ExtensionDtype): diff --git a/pandas/tests/extension/json/test_json.py b/pandas/tests/extension/json/test_json.py index 15d99f6c5d2fc3..d6528e30855272 100644 --- a/pandas/tests/extension/json/test_json.py +++ b/pandas/tests/extension/json/test_json.py @@ -1,5 +1,5 @@ -import operator import collections +import operator import pytest diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index a4518798aa4006..b5ded1890ae649 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -15,14 +15,14 @@ """ import string -import pytest -import pandas as pd import numpy as np +import pytest -from pandas.api.types import CategoricalDtype +import pandas as pd +import pandas.util.testing as tm from pandas import Categorical +from pandas.api.types import CategoricalDtype from pandas.tests.extension import base -import pandas.util.testing as tm def make_data(): diff --git a/pandas/tests/extension/test_common.py b/pandas/tests/extension/test_common.py index a0a8f86a5d7b5f..8a026a0c382839 100644 --- a/pandas/tests/extension/test_common.py +++ b/pandas/tests/extension/test_common.py @@ -4,8 +4,8 @@ import pandas as pd import pandas.util.testing as tm from pandas.core.arrays import ExtensionArray -from pandas.core.dtypes.common import is_extension_array_dtype from pandas.core.dtypes import dtypes +from pandas.core.dtypes.common import is_extension_array_dtype class DummyDtype(dtypes.ExtensionDtype): diff --git a/pandas/tests/extension/test_external_block.py b/pandas/tests/extension/test_external_block.py index aa32bf60516177..1b3f285e64059e 100644 --- a/pandas/tests/extension/test_external_block.py +++ b/pandas/tests/extension/test_external_block.py @@ -2,14 +2,12 @@ # pylint: disable=W0102 import numpy as np +import pytest import pandas as pd -from pandas.core.internals import ( - BlockManager, SingleBlockManager) +from pandas.core.internals import BlockManager, SingleBlockManager from pandas.core.internals.blocks import Block, NonConsolidatableMixIn -import pytest - class CustomBlock(NonConsolidatableMixIn, Block): diff --git a/pandas/tests/extension/test_integer.py b/pandas/tests/extension/test_integer.py index 26b09d545378be..680cf83c64b9ed 100644 --- a/pandas/tests/extension/test_integer.py +++ b/pandas/tests/extension/test_integer.py @@ -14,16 +14,16 @@ """ import numpy as np -import pandas as pd import pytest -from pandas.tests.extension import base -from pandas.core.dtypes.common import is_extension_array_dtype - +import pandas as pd from pandas.core.arrays import integer_array from pandas.core.arrays.integer import ( - Int8Dtype, Int16Dtype, Int32Dtype, Int64Dtype, - UInt8Dtype, UInt16Dtype, UInt32Dtype, UInt64Dtype) + Int8Dtype, Int16Dtype, Int32Dtype, Int64Dtype, UInt8Dtype, UInt16Dtype, + UInt32Dtype, UInt64Dtype +) +from pandas.core.dtypes.common import is_extension_array_dtype +from pandas.tests.extension import base def make_data(): diff --git a/pandas/tests/extension/test_interval.py b/pandas/tests/extension/test_interval.py index 183ebea927b105..3ffb88ef302e9f 100644 --- a/pandas/tests/extension/test_interval.py +++ b/pandas/tests/extension/test_interval.py @@ -13,14 +13,14 @@ be added to the array-specific tests in `pandas/tests/arrays/`. """ -import pytest import numpy as np +import pytest +import pandas.util.testing as tm from pandas import Interval from pandas.core.arrays import IntervalArray from pandas.core.dtypes.dtypes import IntervalDtype from pandas.tests.extension import base -import pandas.util.testing as tm def make_data(): diff --git a/pandas/tests/extension/test_sparse.py b/pandas/tests/extension/test_sparse.py index 6946da6fdc36d0..8c038b3950a261 100644 --- a/pandas/tests/extension/test_sparse.py +++ b/pandas/tests/extension/test_sparse.py @@ -1,11 +1,11 @@ -import pytest -import pandas as pd import numpy as np +import pytest +import pandas as pd +import pandas.util.testing as tm from pandas import SparseArray, SparseDtype from pandas.errors import PerformanceWarning from pandas.tests.extension import base -import pandas.util.testing as tm def make_data(fill_value): diff --git a/setup.cfg b/setup.cfg index 162c6983f9e296..e1d0dc84f464a7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -246,6 +246,7 @@ skip= pandas/tests/indexes/timedeltas/test_partial_slicing.py, pandas/tests/indexes/timedeltas/test_timedelta_range.py, pandas/tests/indexes/timedeltas/test_ops.py, + pandas/tests/series/test_duplicates.py, pandas/tests/series/indexing/test_callable.py, pandas/tests/arrays/test_datetimelike.py, pandas/tests/arrays/test_integer.py, @@ -255,29 +256,6 @@ skip= pandas/tests/util/test_testing.py, pandas/tests/util/test_util.py, pandas/tests/util/test_hashing.py, - pandas/tests/series/test_duplicates.py - pandas/tests/extension/test_common.py, - pandas/tests/extension/test_integer.py, - pandas/tests/extension/test_external_block.py, - pandas/tests/extension/test_interval.py, - pandas/tests/extension/test_categorical.py, - pandas/tests/extension/base/ops.py, - pandas/tests/extension/base/reshaping.py, - pandas/tests/extension/base/getitem.py, - pandas/tests/extension/base/groupby.py, - pandas/tests/extension/base/constructors.py, - pandas/tests/extension/base/interface.py, - pandas/tests/extension/base/dtype.py, - pandas/tests/extension/base/casting.py, - pandas/tests/extension/base/methods.py, - pandas/tests/extension/base/missing.py, - pandas/tests/extension/base/setitem.py, - pandas/tests/extension/arrow/test_bool.py, - pandas/tests/extension/arrow/bool.py, - pandas/tests/extension/decimal/array.py, - pandas/tests/extension/decimal/test_decimal.py, - pandas/tests/extension/json/array.py, - pandas/tests/extension/json/test_json.py, pandas/tests/io/test_clipboard.py, pandas/tests/io/test_compression.py, pandas/tests/io/test_pytables.py, @@ -483,3 +461,4 @@ skip= pandas/plotting/_misc.py, pandas/types/common.py, pandas/plotting/_compat.py, + pandas/tests/extension/arrow/test_bool.py