Skip to content

Commit b51c2e1

Browse files
committed
fixturize
1 parent 37efd51 commit b51c2e1

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

pandas/tests/indexes/test_numeric.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
from pandas.tests.indexes.common import Base
1919

2020

21-
zeros = tm.gen_zeros(5)
22-
zeros = [x for x in zeros if not isinstance(x, Series)]
21+
zeros = [box([0] * 5, dtype=dtype)
22+
for box in [pd.Index, np.array]
23+
for dtype in [np.int64, np.uint64, np.float64]]
24+
zeros.extend([np.array(0, dtype=dtype)
25+
for dtype in [np.int64, np.uint64, np.float64]])
26+
zeros.extend([0, 0.0, long(0)])
27+
2328

2429
@pytest.fixture(params=zeros)
2530
def zero(request):

pandas/util/testing.py

-26
Original file line numberDiff line numberDiff line change
@@ -1974,32 +1974,6 @@ def add_nans_panel4d(panel4d):
19741974
return panel4d
19751975

19761976

1977-
def gen_zeros(arr_len):
1978-
"""
1979-
For testing division by (or of) zero for Series or Indexes with the given
1980-
length, this gives variants of scalar zeros and vector zeros with different
1981-
dtypes.
1982-
1983-
Generate variants of scalar zeros and all-zero arrays with the given
1984-
length.
1985-
1986-
Parameters
1987-
----------
1988-
arr_len : int
1989-
1990-
Returns
1991-
-------
1992-
zeros : list
1993-
"""
1994-
zeros = [box([0] * arr_len, dtype=dtype)
1995-
for box in [pd.Series, pd.Index, np.array]
1996-
for dtype in [np.int64, np.uint64, np.float64]]
1997-
zeros.extend([np.array(0, dtype=dtype)
1998-
for dtype in [np.int64, np.uint64, np.float64]])
1999-
zeros.extend([0, 0.0, long(0)])
2000-
return zeros
2001-
2002-
20031977
class TestSubDict(dict):
20041978

20051979
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)