Skip to content

Commit

Permalink
Provide default implementation for data_repated (#22935)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger authored Oct 2, 2018
1 parent 5ce06b5 commit 6247da0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 38 deletions.
20 changes: 16 additions & 4 deletions pandas/tests/extension/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,24 @@ def all_data(request, data, data_missing):


@pytest.fixture
def data_repeated():
"""Return different versions of data for count times"""
def data_repeated(data):
"""
Generate many datasets.
Parameters
----------
data : fixture implementing `data`
Returns
-------
Callable[[int], Generator]:
A callable that takes a `count` argument and
returns a generator yielding `count` datasets.
"""
def gen(count):
for _ in range(count):
yield NotImplementedError
yield gen
yield data
return gen


@pytest.fixture
Expand Down
8 changes: 0 additions & 8 deletions pandas/tests/extension/decimal/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ def data_missing():
return DecimalArray([decimal.Decimal('NaN'), decimal.Decimal(1)])


@pytest.fixture
def data_repeated():
def gen(count):
for _ in range(count):
yield DecimalArray(make_data())
yield gen


@pytest.fixture
def data_for_sorting():
return DecimalArray([decimal.Decimal('1'),
Expand Down
9 changes: 0 additions & 9 deletions pandas/tests/extension/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ def data_missing():
return Categorical([np.nan, 'A'])


@pytest.fixture
def data_repeated():
"""Return different versions of data for count times"""
def gen(count):
for _ in range(count):
yield Categorical(make_data())
yield gen


@pytest.fixture
def data_for_sorting():
return Categorical(['A', 'B', 'C'], categories=['C', 'A', 'B'],
Expand Down
8 changes: 0 additions & 8 deletions pandas/tests/extension/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ def data_missing(dtype):
return integer_array([np.nan, 1], dtype=dtype)


@pytest.fixture
def data_repeated(data):
def gen(count):
for _ in range(count):
yield data
yield gen


@pytest.fixture
def data_for_sorting(dtype):
return integer_array([1, 2, 0], dtype=dtype)
Expand Down
9 changes: 0 additions & 9 deletions pandas/tests/extension/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ def data_missing():
return IntervalArray.from_tuples([None, (0, 1)])


@pytest.fixture
def data_repeated():
"""Return different versions of data for count times"""
def gen(count):
for _ in range(count):
yield IntervalArray(make_data())
yield gen


@pytest.fixture
def data_for_sorting():
return IntervalArray.from_tuples([(1, 2), (2, 3), (0, 1)])
Expand Down

0 comments on commit 6247da0

Please sign in to comment.