Skip to content

Commit

Permalink
fixturize
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Jan 31, 2018
1 parent 37efd51 commit b51c2e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
9 changes: 7 additions & 2 deletions pandas/tests/indexes/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
from pandas.tests.indexes.common import Base


zeros = tm.gen_zeros(5)
zeros = [x for x in zeros if not isinstance(x, Series)]
zeros = [box([0] * 5, dtype=dtype)
for box in [pd.Index, np.array]
for dtype in [np.int64, np.uint64, np.float64]]
zeros.extend([np.array(0, dtype=dtype)
for dtype in [np.int64, np.uint64, np.float64]])
zeros.extend([0, 0.0, long(0)])


@pytest.fixture(params=zeros)
def zero(request):
Expand Down
26 changes: 0 additions & 26 deletions pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1974,32 +1974,6 @@ def add_nans_panel4d(panel4d):
return panel4d


def gen_zeros(arr_len):
"""
For testing division by (or of) zero for Series or Indexes with the given
length, this gives variants of scalar zeros and vector zeros with different
dtypes.
Generate variants of scalar zeros and all-zero arrays with the given
length.
Parameters
----------
arr_len : int
Returns
-------
zeros : list
"""
zeros = [box([0] * arr_len, dtype=dtype)
for box in [pd.Series, pd.Index, np.array]
for dtype in [np.int64, np.uint64, np.float64]]
zeros.extend([np.array(0, dtype=dtype)
for dtype in [np.int64, np.uint64, np.float64]])
zeros.extend([0, 0.0, long(0)])
return zeros


class TestSubDict(dict):

def __init__(self, *args, **kwargs):
Expand Down

0 comments on commit b51c2e1

Please sign in to comment.