Skip to content

CLN/TST: Resample fixtures #56608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 0 additions & 110 deletions pandas/tests/resample/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
from datetime import datetime

import numpy as np
import pytest

from pandas import (
DataFrame,
Series,
)

# The various methods we support
downsample_methods = [
"min",
Expand Down Expand Up @@ -39,105 +31,3 @@ def downsample_method(request):
def resample_method(request):
"""Fixture for parametrization of Grouper resample methods."""
return request.param


@pytest.fixture
def _index_start():
"""Fixture for parametrization of index, series and frame."""
return datetime(2005, 1, 1)


@pytest.fixture
def _index_end():
"""Fixture for parametrization of index, series and frame."""
return datetime(2005, 1, 10)


@pytest.fixture
def _index_freq():
"""Fixture for parametrization of index, series and frame."""
return "D"


@pytest.fixture
def _index_name():
"""Fixture for parametrization of index, series and frame."""
return None


@pytest.fixture
def index(_index_factory, _index_start, _index_end, _index_freq, _index_name):
"""
Fixture for parametrization of date_range, period_range and
timedelta_range indexes
"""
return _index_factory(_index_start, _index_end, freq=_index_freq, name=_index_name)


@pytest.fixture
def _static_values(index):
"""
Fixture for parametrization of values used in parametrization of
Series and DataFrames with date_range, period_range and
timedelta_range indexes
"""
return np.arange(len(index))


@pytest.fixture
def _series_name():
"""
Fixture for parametrization of Series name for Series used with
date_range, period_range and timedelta_range indexes
"""
return None


@pytest.fixture
def series(index, _series_name, _static_values):
"""
Fixture for parametrization of Series with date_range, period_range and
timedelta_range indexes
"""
return Series(_static_values, index=index, name=_series_name)


@pytest.fixture
def empty_series_dti(series):
"""
Fixture for parametrization of empty Series with date_range,
period_range and timedelta_range indexes
"""
return series[:0]


@pytest.fixture
def frame(index, _series_name, _static_values):
"""
Fixture for parametrization of DataFrame with date_range, period_range
and timedelta_range indexes
"""
# _series_name is intentionally unused
return DataFrame({"value": _static_values}, index=index)


@pytest.fixture
def empty_frame_dti(series):
"""
Fixture for parametrization of empty DataFrame with date_range,
period_range and timedelta_range indexes
"""
index = series.index[:0]
return DataFrame(index=index)


@pytest.fixture
def series_and_frame(frame_or_series, series, frame):
"""
Fixture for parametrization of Series and DataFrame with date_range,
period_range and timedelta_range indexes
"""
if frame_or_series == Series:
return series
if frame_or_series == DataFrame:
return frame
Loading