Skip to content

Commit 7c8bd65

Browse files
committed
Adjust test and move import to top
1 parent 33ed819 commit 7c8bd65

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pandas/core/reshape/tile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Quantilization functions and related stuff
33
"""
4+
from functools import partial
45

56
from pandas.core.dtypes.missing import isna
67
from pandas.core.dtypes.common import (
@@ -337,7 +338,6 @@ def _format_labels(bins, precision, right=True,
337338
closed = 'right' if right else 'left'
338339

339340
if is_datetime64tz_dtype(dtype):
340-
from functools import partial
341341
formatter = partial(Timestamp, tz=dtype.tz)
342342
adjust = lambda x: x - Timedelta('1ns')
343343
elif is_datetime64_dtype(dtype):

pandas/tests/reshape/test_tile.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55
from pandas.compat import zip
66

7-
from pandas import (DataFrame, Series, isna, to_datetime, DatetimeIndex,
7+
from pandas import (DataFrame, Series, isna, to_datetime, DatetimeIndex, Index,
88
Timestamp, Interval, IntervalIndex, Categorical,
99
cut, qcut, date_range, NaT, TimedeltaIndex)
1010
from pandas.tseries.offsets import Nano, Day
@@ -105,10 +105,12 @@ def test_cut_corner(self):
105105
pytest.raises(ValueError, cut, [1, 2, 3], 0.5)
106106

107107
@pytest.mark.parametrize('arg', [2, np.eye(2), DataFrame(np.eye(2))])
108+
@pytest.mark.parametrize('bins', [2, np.array(2), np.arange(1, 2), [1, 2],
109+
Series([1, 2]), Index([1, 2])])
108110
@pytest.mark.parametrize('cut_func', [cut, qcut])
109-
def test_cut_not_1d_arg(self, arg, cut_func):
111+
def test_cut_not_1d_arg(self, arg, bins, cut_func):
110112
with pytest.raises(ValueError):
111-
cut_func(arg, 2)
113+
cut_func(arg, bins)
112114

113115
def test_cut_out_of_range_more(self):
114116
# #1511

0 commit comments

Comments
 (0)