111 lines
2.3 KiB
Python
111 lines
2.3 KiB
Python
import operator
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def dtype():
|
|
"""A fixture providing the ExtensionDtype to validate."""
|
|
raise NotImplementedError
|
|
|
|
|
|
@pytest.fixture
|
|
def data():
|
|
"""Length-100 array for this type.
|
|
|
|
* data[0] and data[1] should both be non missing
|
|
* data[0] and data[1] should not gbe equal
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
|
|
@pytest.fixture
|
|
def data_missing():
|
|
"""Length-2 array with [NA, Valid]"""
|
|
raise NotImplementedError
|
|
|
|
|
|
@pytest.fixture(params=['data', 'data_missing'])
|
|
def all_data(request, data, data_missing):
|
|
"""Parametrized fixture giving 'data' and 'data_missing'"""
|
|
if request.param == 'data':
|
|
return data
|
|
elif request.param == 'data_missing':
|
|
return data_missing
|
|
|
|
|
|
@pytest.fixture
|
|
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 data
|
|
return gen
|
|
|
|
|
|
@pytest.fixture
|
|
def data_for_sorting():
|
|
"""Length-3 array with a known sort order.
|
|
|
|
This should be three items [B, C, A] with
|
|
A < B < C
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
|
|
@pytest.fixture
|
|
def data_missing_for_sorting():
|
|
"""Length-3 array with a known sort order.
|
|
|
|
This should be three items [B, NA, A] with
|
|
A < B and NA missing.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
|
|
@pytest.fixture
|
|
def na_cmp():
|
|
"""Binary operator for comparing NA values.
|
|
|
|
Should return a function of two arguments that returns
|
|
True if both arguments are (scalar) NA for your type.
|
|
|
|
By default, uses ``operator.is_``
|
|
"""
|
|
return operator.is_
|
|
|
|
|
|
@pytest.fixture
|
|
def na_value():
|
|
"""The scalar missing value for this type. Default 'None'"""
|
|
return None
|
|
|
|
|
|
@pytest.fixture
|
|
def data_for_grouping():
|
|
"""Data for factorization, grouping, and unique tests.
|
|
|
|
Expected to be like [B, B, NA, NA, A, A, B, C]
|
|
|
|
Where A < B < C and NA is missing
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
|
|
@pytest.fixture(params=[True, False])
|
|
def box_in_series(request):
|
|
"""Whether to box the data in a Series"""
|
|
return request.param
|