From 2670ae564cde3673ebaff7a9362669e4554c6e5f Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 2 Jan 2019 14:17:15 +0000 Subject: [PATCH] TST: isort tests/reshape --- pandas/tests/reshape/merge/test_join.py | 16 +++++----- pandas/tests/reshape/merge/test_merge.py | 20 +++++++------ pandas/tests/reshape/merge/test_merge_asof.py | 7 ++--- .../tests/reshape/merge/test_merge_ordered.py | 4 +-- pandas/tests/reshape/test_concat.py | 29 +++++++++---------- pandas/tests/reshape/test_melt.py | 12 ++++---- pandas/tests/reshape/test_pivot.py | 18 ++++++------ pandas/tests/reshape/test_reshape.py | 19 ++++++------ .../tests/reshape/test_union_categoricals.py | 7 +++-- pandas/tests/reshape/test_util.py | 7 +++-- setup.cfg | 12 -------- 11 files changed, 69 insertions(+), 82 deletions(-) diff --git a/pandas/tests/reshape/merge/test_join.py b/pandas/tests/reshape/merge/test_join.py index 083ce16ef9296..8ee1e49f01ac1 100644 --- a/pandas/tests/reshape/merge/test_join.py +++ b/pandas/tests/reshape/merge/test_join.py @@ -1,20 +1,20 @@ # pylint: disable=E1103 from warnings import catch_warnings -from numpy.random import randn + import numpy as np +from numpy.random import randn import pytest -import pandas as pd -from pandas.compat import lrange +from pandas._libs import join as libjoin import pandas.compat as compat -from pandas.util.testing import assert_frame_equal -from pandas import DataFrame, MultiIndex, Series, Index, merge, concat +from pandas.compat import lrange -from pandas._libs import join as libjoin +import pandas as pd +from pandas import DataFrame, Index, MultiIndex, Series, concat, merge +from pandas.tests.reshape.merge.test_merge import NGROUPS, N, get_test_data import pandas.util.testing as tm -from pandas.tests.reshape.merge.test_merge import get_test_data, N, NGROUPS - +from pandas.util.testing import assert_frame_equal a_ = np.array diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py index 970802e94662a..f6882e9bc8394 100644 --- a/pandas/tests/reshape/merge/test_merge.py +++ b/pandas/tests/reshape/merge/test_merge.py @@ -1,25 +1,27 @@ # pylint: disable=E1103 -import random -import re from collections import OrderedDict from datetime import date, datetime +import random +import re import numpy as np -import pytest from numpy import nan +import pytest -import pandas as pd -import pandas.util.testing as tm -from pandas import (Categorical, CategoricalIndex, DataFrame, DatetimeIndex, - Float64Index, Int64Index, MultiIndex, RangeIndex, - Series, UInt64Index) -from pandas.api.types import CategoricalDtype as CDT from pandas.compat import lrange + from pandas.core.dtypes.common import is_categorical_dtype, is_object_dtype from pandas.core.dtypes.dtypes import CategoricalDtype + +import pandas as pd +from pandas import ( + Categorical, CategoricalIndex, DataFrame, DatetimeIndex, Float64Index, + Int64Index, MultiIndex, RangeIndex, Series, UInt64Index) +from pandas.api.types import CategoricalDtype as CDT from pandas.core.reshape.concat import concat from pandas.core.reshape.merge import MergeError, merge +import pandas.util.testing as tm from pandas.util.testing import assert_frame_equal, assert_series_equal N = 50 diff --git a/pandas/tests/reshape/merge/test_merge_asof.py b/pandas/tests/reshape/merge/test_merge_asof.py index 3035412d7b836..1483654daa99e 100644 --- a/pandas/tests/reshape/merge/test_merge_asof.py +++ b/pandas/tests/reshape/merge/test_merge_asof.py @@ -1,10 +1,9 @@ +import numpy as np import pytest - import pytz -import numpy as np + import pandas as pd -from pandas import (merge_asof, read_csv, - to_datetime, Timedelta) +from pandas import Timedelta, merge_asof, read_csv, to_datetime from pandas.core.reshape.merge import MergeError from pandas.util.testing import assert_frame_equal diff --git a/pandas/tests/reshape/merge/test_merge_ordered.py b/pandas/tests/reshape/merge/test_merge_ordered.py index 0f8ecc6370bfd..414f46cdb296c 100644 --- a/pandas/tests/reshape/merge/test_merge_ordered.py +++ b/pandas/tests/reshape/merge/test_merge_ordered.py @@ -1,10 +1,10 @@ +from numpy import nan import pytest + import pandas as pd from pandas import DataFrame, merge_ordered from pandas.util.testing import assert_frame_equal -from numpy import nan - class TestMergeOrdered(object): diff --git a/pandas/tests/reshape/test_concat.py b/pandas/tests/reshape/test_concat.py index 0706cb12ac5d0..051462c5e9fc6 100644 --- a/pandas/tests/reshape/test_concat.py +++ b/pandas/tests/reshape/test_concat.py @@ -1,27 +1,26 @@ -from warnings import catch_warnings, simplefilter -from itertools import combinations from collections import deque +import datetime as dt +from datetime import datetime from decimal import Decimal +from itertools import combinations +from warnings import catch_warnings, simplefilter -import datetime as dt import dateutil import numpy as np from numpy.random import randn +import pytest + +from pandas.compat import PY2, Iterable, StringIO, iteritems -from datetime import datetime -from pandas.compat import Iterable, StringIO, iteritems, PY2 -import pandas as pd -from pandas import (DataFrame, concat, - read_csv, isna, Series, date_range, - Index, Panel, MultiIndex, Timestamp, - DatetimeIndex, Categorical) from pandas.core.dtypes.dtypes import CategoricalDtype -from pandas.util import testing as tm -from pandas.util.testing import (assert_frame_equal, - makeCustomDataframe as mkdf) -from pandas.tests.extension.decimal import to_decimal -import pytest +import pandas as pd +from pandas import ( + Categorical, DataFrame, DatetimeIndex, Index, MultiIndex, Panel, Series, + Timestamp, concat, date_range, isna, read_csv) +from pandas.tests.extension.decimal import to_decimal +from pandas.util import testing as tm +from pandas.util.testing import assert_frame_equal, makeCustomDataframe as mkdf @pytest.fixture(params=[True, False]) diff --git a/pandas/tests/reshape/test_melt.py b/pandas/tests/reshape/test_melt.py index 8fd3ae8bb387b..6b633d7e77f52 100644 --- a/pandas/tests/reshape/test_melt.py +++ b/pandas/tests/reshape/test_melt.py @@ -1,17 +1,15 @@ # -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101 +import numpy as np +from numpy import nan import pytest -from pandas import DataFrame -import pandas as pd - -from numpy import nan -import numpy as np +from pandas.compat import range -from pandas import melt, lreshape, wide_to_long +import pandas as pd +from pandas import DataFrame, lreshape, melt, wide_to_long import pandas.util.testing as tm -from pandas.compat import range class TestMelt(object): diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index a2b5eacd873bb..f0d1ad57ba829 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -1,20 +1,20 @@ # -*- coding: utf-8 -*- -from datetime import datetime, date, timedelta +from collections import OrderedDict +from datetime import date, datetime, timedelta +import numpy as np import pytest +from pandas.compat import product, range -import numpy as np - -from collections import OrderedDict import pandas as pd -from pandas import (DataFrame, Series, Index, MultiIndex, - Grouper, date_range, concat, Categorical) -from pandas.core.reshape.pivot import pivot_table, crosstab -from pandas.compat import range, product -import pandas.util.testing as tm +from pandas import ( + Categorical, DataFrame, Grouper, Index, MultiIndex, Series, concat, + date_range) from pandas.api.types import CategoricalDtype as CDT +from pandas.core.reshape.pivot import crosstab, pivot_table +import pandas.util.testing as tm @pytest.fixture(params=[True, False]) diff --git a/pandas/tests/reshape/test_reshape.py b/pandas/tests/reshape/test_reshape.py index edbe70d308b96..7b544b7981c1f 100644 --- a/pandas/tests/reshape/test_reshape.py +++ b/pandas/tests/reshape/test_reshape.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101 -import pytest from collections import OrderedDict -from pandas import DataFrame, Series -from pandas.core.dtypes.common import is_integer_dtype -from pandas.core.sparse.api import SparseDtype, SparseArray -import pandas as pd - -from numpy import nan import numpy as np +from numpy import nan +import pytest -from pandas.util.testing import assert_frame_equal +from pandas.compat import u + +from pandas.core.dtypes.common import is_integer_dtype -from pandas import get_dummies, Categorical, Index +import pandas as pd +from pandas import Categorical, DataFrame, Index, Series, get_dummies +from pandas.core.sparse.api import SparseArray, SparseDtype import pandas.util.testing as tm -from pandas.compat import u +from pandas.util.testing import assert_frame_equal class TestGetDummies(object): diff --git a/pandas/tests/reshape/test_union_categoricals.py b/pandas/tests/reshape/test_union_categoricals.py index 80538b0c6de4e..9b2b8bf9ed49f 100644 --- a/pandas/tests/reshape/test_union_categoricals.py +++ b/pandas/tests/reshape/test_union_categoricals.py @@ -1,9 +1,10 @@ +import numpy as np import pytest -import numpy as np -import pandas as pd -from pandas import Categorical, Series, CategoricalIndex from pandas.core.dtypes.concat import union_categoricals + +import pandas as pd +from pandas import Categorical, CategoricalIndex, Series from pandas.util import testing as tm diff --git a/pandas/tests/reshape/test_util.py b/pandas/tests/reshape/test_util.py index e7e1626bdb2da..a8d9e7a775442 100644 --- a/pandas/tests/reshape/test_util.py +++ b/pandas/tests/reshape/test_util.py @@ -1,8 +1,9 @@ -import pytest import numpy as np -from pandas import date_range, Index -import pandas.util.testing as tm +import pytest + +from pandas import Index, date_range from pandas.core.reshape.util import cartesian_product +import pandas.util.testing as tm class TestCartesianProduct(object): diff --git a/setup.cfg b/setup.cfg index 59e5991914ca6..15a5384bc632c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -182,18 +182,6 @@ skip= pandas/tests/plotting/common.py, pandas/tests/plotting/test_boxplot_method.py, pandas/tests/plotting/test_deprecated.py, - pandas/tests/reshape/test_concat.py, - pandas/tests/reshape/test_util.py, - pandas/tests/reshape/test_reshape.py, - pandas/tests/reshape/test_tile.py, - pandas/tests/reshape/test_pivot.py, - pandas/tests/reshape/test_melt.py, - pandas/tests/reshape/test_union_categoricals.py, - pandas/tests/reshape/merge/test_merge_index_as_string.py, - pandas/tests/reshape/merge/test_merge.py, - pandas/tests/reshape/merge/test_merge_asof.py, - pandas/tests/reshape/merge/test_join.py, - pandas/tests/reshape/merge/test_merge_ordered.py, pandas/tests/sparse/test_indexing.py, pandas/tests/extension/test_sparse.py, pandas/tests/extension/base/reduce.py,