Skip to content

ASV: compatibility import for testing module #30810

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from pandas._libs import lib

import pandas as pd
from pandas.util import testing as tm

from .pandas_vb_common import tm

for imp in ["pandas.util", "pandas.tools.hashing"]:
try:
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/categoricals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import numpy as np

import pandas as pd
import pandas.util.testing as tm

from .pandas_vb_common import tm

try:
from pandas.api.types import union_categoricals
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/ctors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np

from pandas import DatetimeIndex, Index, MultiIndex, Series, Timestamp
import pandas.util.testing as tm

from .pandas_vb_common import tm


def no_change(arr):
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/frame_ctor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np

from pandas import DataFrame, MultiIndex, Series, Timestamp, date_range
import pandas.util.testing as tm

from .pandas_vb_common import tm

try:
from pandas.tseries.offsets import Nano, Hour
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/frame_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import numpy as np

from pandas import DataFrame, MultiIndex, NaT, Series, date_range, isnull, period_range
import pandas.util.testing as tm

from .pandas_vb_common import tm


class GetNumericData:
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/gil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from pandas import DataFrame, Series, date_range, factorize, read_csv
from pandas.core.algorithms import take_1d
import pandas.util.testing as tm

from .pandas_vb_common import tm

try:
from pandas import (
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
date_range,
period_range,
)
import pandas.util.testing as tm

from .pandas_vb_common import tm

method_blacklist = {
"object": {
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/index_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
Series,
date_range,
)
import pandas.util.testing as tm

from .pandas_vb_common import tm


class SetOperations:
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
option_context,
period_range,
)
import pandas.util.testing as tm

from .pandas_vb_common import tm


class NumericSeriesIndexing:
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/inference.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import numpy as np

from pandas import DataFrame, Series, to_numeric
import pandas.util.testing as tm

from .pandas_vb_common import lib, numeric_dtypes
from .pandas_vb_common import lib, numeric_dtypes, tm


class NumericInferOps:
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/io/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import numpy as np

from pandas import Categorical, DataFrame, date_range, read_csv, to_datetime
import pandas.util.testing as tm

from ..pandas_vb_common import BaseIO
from ..pandas_vb_common import BaseIO, tm


class ToCSV(BaseIO):
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/io/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from odf.text import P

from pandas import DataFrame, ExcelWriter, date_range, read_excel
import pandas.util.testing as tm

from ..pandas_vb_common import tm


def _generate_dataframe():
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/io/hdf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import numpy as np

from pandas import DataFrame, HDFStore, date_range, read_hdf
import pandas.util.testing as tm

from ..pandas_vb_common import BaseIO
from ..pandas_vb_common import BaseIO, tm


class HDFStoreDataFrame(BaseIO):
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/io/json.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import numpy as np

from pandas import DataFrame, concat, date_range, read_json, timedelta_range
import pandas.util.testing as tm

from ..pandas_vb_common import BaseIO
from ..pandas_vb_common import BaseIO, tm


class ReadJSON(BaseIO):
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/io/pickle.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import numpy as np

from pandas import DataFrame, date_range, read_pickle
import pandas.util.testing as tm

from ..pandas_vb_common import BaseIO
from ..pandas_vb_common import BaseIO, tm


class Pickle(BaseIO):
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from sqlalchemy import create_engine

from pandas import DataFrame, date_range, read_sql_query, read_sql_table
import pandas.util.testing as tm

from ..pandas_vb_common import tm


class SQL:
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/io/stata.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import numpy as np

from pandas import DataFrame, date_range, read_stata
import pandas.util.testing as tm

from ..pandas_vb_common import BaseIO
from ..pandas_vb_common import BaseIO, tm


class Stata(BaseIO):
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/join_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import numpy as np

from pandas import DataFrame, MultiIndex, Series, concat, date_range, merge, merge_asof
import pandas.util.testing as tm

from .pandas_vb_common import tm

try:
from pandas import merge_ordered
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/multiindex_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import numpy as np

from pandas import DataFrame, MultiIndex, RangeIndex, date_range
import pandas.util.testing as tm

from .pandas_vb_common import tm


class GetLoc:
Expand Down
7 changes: 7 additions & 0 deletions asv_bench/benchmarks/pandas_vb_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
except (ImportError, TypeError, ValueError):
pass

# Compatibility import for the testing module
try:
import pandas._testing as tm # noqa
except ImportError:
import pandas.util.testing as tm # noqa


numeric_dtypes = [
np.int64,
np.int32,
Expand Down
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/reindex.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import numpy as np

from pandas import DataFrame, Index, MultiIndex, Series, date_range, period_range
import pandas.util.testing as tm

from .pandas_vb_common import lib
from .pandas_vb_common import lib, tm


class Reindex:
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/series_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import numpy as np

from pandas import NaT, Series, date_range
import pandas.util.testing as tm

from .pandas_vb_common import tm


class SeriesConstructor:
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import numpy as np

from pandas import DataFrame, Series
import pandas.util.testing as tm

from .pandas_vb_common import tm


class Methods:
Expand Down