Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lib/python3.12/site-packages/pandas/tests/api/__init__.pyAdded
- lib/python3.12/site-packages/pandas/tests/api/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/api/__pycache__/test_types.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/api/test_api.pyAdded+383
- lib/python3.12/site-packages/pandas/tests/api/test_types.pyAdded+62
- lib/python3.12/site-packages/pandas/tests/construction/__init__.pyAdded
- lib/python3.12/site-packages/pandas/tests/construction/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/construction/__pycache__/test_extract_array.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/construction/test_extract_array.pyAdded+18
- lib/python3.12/site-packages/pandas/tests/extension/__init__.pyAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/conftest.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_categorical.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_common.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_datetime.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_extension.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_interval.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_masked.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_numpy.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_period.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_sparse.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_string.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__init__.pyAdded+6
- lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__pycache__/array.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__pycache__/test_array_with_attr.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/array.pyAdded+89
- lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/test_array_with_attr.pyAdded+33
- lib/python3.12/site-packages/pandas/tests/extension/base/__init__.pyAdded+131
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/accumulate.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/base.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/casting.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/constructors.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/dim2.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/dtype.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/getitem.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/groupby.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/index.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/interface.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/io.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/methods.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/missing.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/ops.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/printing.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/reduce.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/reshaping.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/setitem.cpython-312.pycAdded
- lib/python3.12/site-packages/pandas/tests/extension/base/accumulate.pyAdded+39
- lib/python3.12/site-packages/pandas/tests/extension/base/base.pyAdded+2
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383from __future__ import annotations
import pytest
import pandas as pdfrom pandas import apiimport pandas._testing as tmfrom pandas.api import ( extensions as api_extensions, indexers as api_indexers, interchange as api_interchange, types as api_types, typing as api_typing,)
class Base: def check(self, namespace, expected, ignored=None): # see which names are in the namespace, minus optional # ignored ones # compare vs the expected
result = sorted( f for f in dir(namespace) if not f.startswith("__") and f != "annotations" ) if ignored is not None: result = sorted(set(result) - set(ignored))
expected = sorted(expected) tm.assert_almost_equal(result, expected)
class TestPDApi(Base): # these are optionally imported based on testing # & need to be ignored ignored = ["tests", "locale", "conftest", "_version_meson"]
# top-level sub-packages public_lib = [ "api", "arrays", "options", "test", "testing", "errors", "plotting", "io", "tseries", ] private_lib = ["compat", "core", "pandas", "util", "_built_with_meson"]
# misc misc = ["IndexSlice", "NaT", "NA"]
# top-level classes classes = [ "ArrowDtype", "Categorical", "CategoricalIndex", "DataFrame", "DateOffset", "DatetimeIndex", "ExcelFile", "ExcelWriter", "Flags", "Grouper", "HDFStore", "Index", "MultiIndex", "Period", "PeriodIndex", "RangeIndex", "Series", "SparseDtype", "StringDtype", "Timedelta", "TimedeltaIndex", "Timestamp", "Interval", "IntervalIndex", "CategoricalDtype", "PeriodDtype", "IntervalDtype", "DatetimeTZDtype", "BooleanDtype", "Int8Dtype", "Int16Dtype", "Int32Dtype", "Int64Dtype", "UInt8Dtype", "UInt16Dtype", "UInt32Dtype", "UInt64Dtype", "Float32Dtype", "Float64Dtype", "NamedAgg", ]
# these are already deprecated; awaiting removal deprecated_classes: list[str] = []
# external modules exposed in pandas namespace modules: list[str] = []
# top-level functions funcs = [ "array", "bdate_range", "concat", "crosstab", "cut", "date_range", "interval_range", "eval", "factorize", "get_dummies", "from_dummies", "infer_freq", "isna", "isnull", "lreshape", "melt", "notna", "notnull", "offsets", "merge", "merge_ordered", "merge_asof", "period_range", "pivot", "pivot_table", "qcut", "show_versions", "timedelta_range", "unique", "value_counts", "wide_to_long", ]
# top-level option funcs funcs_option = [ "reset_option", "describe_option", "get_option", "option_context", "set_option", "set_eng_float_format", ]
# top-level read_* funcs funcs_read = [ "read_clipboard", "read_csv", "read_excel", "read_fwf", "read_gbq", "read_hdf", "read_html", "read_xml", "read_json", "read_pickle", "read_sas", "read_sql", "read_sql_query", "read_sql_table", "read_stata", "read_table", "read_feather", "read_parquet", "read_orc", "read_spss", ]
# top-level json funcs funcs_json = ["json_normalize"]
# top-level to_* funcs funcs_to = ["to_datetime", "to_numeric", "to_pickle", "to_timedelta"]
# top-level to deprecate in the future deprecated_funcs_in_future: list[str] = []
# these are already deprecated; awaiting removal deprecated_funcs: list[str] = []
# private modules in pandas namespace private_modules = [ "_config", "_libs", "_is_numpy_dev", "_pandas_datetime_CAPI", "_pandas_parser_CAPI", "_testing", "_typing", ] if not pd._built_with_meson: private_modules.append("_version")
def test_api(self): checkthese = ( self.public_lib + self.private_lib + self.misc + self.modules + self.classes + self.funcs + self.funcs_option + self.funcs_read + self.funcs_json + self.funcs_to + self.private_modules ) self.check(namespace=pd, expected=checkthese, ignored=self.ignored)
def test_api_all(self): expected = set( self.public_lib + self.misc + self.modules + self.classes + self.funcs + self.funcs_option + self.funcs_read + self.funcs_json + self.funcs_to ) - set(self.deprecated_classes) actual = set(pd.__all__)
extraneous = actual - expected assert not extraneous
missing = expected - actual assert not missing
def test_depr(self): deprecated_list = ( self.deprecated_classes + self.deprecated_funcs + self.deprecated_funcs_in_future ) for depr in deprecated_list: with tm.assert_produces_warning(FutureWarning): _ = getattr(pd, depr)
class TestApi(Base): allowed_api_dirs = [ "types", "extensions", "indexers", "interchange", "typing", ] allowed_typing = [ "DataFrameGroupBy", "DatetimeIndexResamplerGroupby", "Expanding", "ExpandingGroupby", "ExponentialMovingWindow", "ExponentialMovingWindowGroupby", "JsonReader", "NaTType", "NAType", "PeriodIndexResamplerGroupby", "Resampler", "Rolling", "RollingGroupby", "SeriesGroupBy", "StataReader", "TimedeltaIndexResamplerGroupby", "TimeGrouper", "Window", ] allowed_api_types = [ "is_any_real_numeric_dtype", "is_array_like", "is_bool", "is_bool_dtype", "is_categorical_dtype", "is_complex", "is_complex_dtype", "is_datetime64_any_dtype", "is_datetime64_dtype", "is_datetime64_ns_dtype", "is_datetime64tz_dtype", "is_dict_like", "is_dtype_equal", "is_extension_array_dtype", "is_file_like", "is_float", "is_float_dtype", "is_hashable", "is_int64_dtype", "is_integer", "is_integer_dtype", "is_interval", "is_interval_dtype", "is_iterator", "is_list_like", "is_named_tuple", "is_number", "is_numeric_dtype", "is_object_dtype", "is_period_dtype", "is_re", "is_re_compilable", "is_scalar", "is_signed_integer_dtype", "is_sparse", "is_string_dtype", "is_timedelta64_dtype", "is_timedelta64_ns_dtype", "is_unsigned_integer_dtype", "pandas_dtype", "infer_dtype", "union_categoricals", "CategoricalDtype", "DatetimeTZDtype", "IntervalDtype", "PeriodDtype", ] allowed_api_interchange = ["from_dataframe", "DataFrame"] allowed_api_indexers = [ "check_array_indexer", "BaseIndexer", "FixedForwardWindowIndexer", "VariableOffsetWindowIndexer", ] allowed_api_extensions = [ "no_default", "ExtensionDtype", "register_extension_dtype", "register_dataframe_accessor", "register_index_accessor", "register_series_accessor", "take", "ExtensionArray", "ExtensionScalarOpsMixin", ]
def test_api(self): self.check(api, self.allowed_api_dirs)
def test_api_typing(self): self.check(api_typing, self.allowed_typing)
def test_api_types(self): self.check(api_types, self.allowed_api_types)
def test_api_interchange(self): self.check(api_interchange, self.allowed_api_interchange)
def test_api_indexers(self): self.check(api_indexers, self.allowed_api_indexers)
def test_api_extensions(self): self.check(api_extensions, self.allowed_api_extensions)
class TestTesting(Base): funcs = [ "assert_frame_equal", "assert_series_equal", "assert_index_equal", "assert_extension_array_equal", ]
def test_testing(self): from pandas import testing
self.check(testing, self.funcs)
def test_util_in_top_level(self): with pytest.raises(AttributeError, match="foo"): pd.util.foo
def test_pandas_array_alias(): msg = "PandasArray has been renamed NumpyExtensionArray" with tm.assert_produces_warning(FutureWarning, match=msg): res = pd.arrays.PandasArray
assert res is pd.arrays.NumpyExtensionArray1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162from __future__ import annotations
import pandas._testing as tmfrom pandas.api import typesfrom pandas.tests.api.test_api import Base
class TestTypes(Base): allowed = [ "is_any_real_numeric_dtype", "is_bool", "is_bool_dtype", "is_categorical_dtype", "is_complex", "is_complex_dtype", "is_datetime64_any_dtype", "is_datetime64_dtype", "is_datetime64_ns_dtype", "is_datetime64tz_dtype", "is_dtype_equal", "is_float", "is_float_dtype", "is_int64_dtype", "is_integer", "is_integer_dtype", "is_number", "is_numeric_dtype", "is_object_dtype", "is_scalar", "is_sparse", "is_string_dtype", "is_signed_integer_dtype", "is_timedelta64_dtype", "is_timedelta64_ns_dtype", "is_unsigned_integer_dtype", "is_period_dtype", "is_interval", "is_interval_dtype", "is_re", "is_re_compilable", "is_dict_like", "is_iterator", "is_file_like", "is_list_like", "is_hashable", "is_array_like", "is_named_tuple", "pandas_dtype", "union_categoricals", "infer_dtype", "is_extension_array_dtype", ] deprecated: list[str] = [] dtypes = ["CategoricalDtype", "DatetimeTZDtype", "PeriodDtype", "IntervalDtype"]
def test_types(self): self.check(types, self.allowed + self.dtypes + self.deprecated)
def test_deprecated_from_api_types(self): for t in self.deprecated: with tm.assert_produces_warning(FutureWarning): getattr(types, t)(1)123456789101112131415161718from pandas import Indeximport pandas._testing as tmfrom pandas.core.construction import extract_array
def test_extract_array_rangeindex(): ri = Index(range(5))
expected = ri._values res = extract_array(ri, extract_numpy=True, extract_range=True) tm.assert_numpy_array_equal(res, expected) res = extract_array(ri, extract_numpy=False, extract_range=True) tm.assert_numpy_array_equal(res, expected)
res = extract_array(ri, extract_numpy=True, extract_range=False) tm.assert_index_equal(res, ri) res = extract_array(ri, extract_numpy=False, extract_range=False) tm.assert_index_equal(res, ri)123456from pandas.tests.extension.array_with_attr.array import ( FloatAttrArray, FloatAttrDtype,)
__all__ = ["FloatAttrArray", "FloatAttrDtype"]1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889"""Test extension array that has custom attribute information (not stored on the dtype).
"""from __future__ import annotations
import numbersfrom typing import TYPE_CHECKING
import numpy as np
from pandas.core.dtypes.base import ExtensionDtype
import pandas as pdfrom pandas.core.arrays import ExtensionArray
if TYPE_CHECKING: from pandas._typing import type_t
class FloatAttrDtype(ExtensionDtype): type = float name = "float_attr" na_value = np.nan
@classmethod def construct_array_type(cls) -> type_t[FloatAttrArray]: """ Return the array type associated with this dtype.
Returns ------- type """ return FloatAttrArray
class FloatAttrArray(ExtensionArray): dtype = FloatAttrDtype() __array_priority__ = 1000
def __init__(self, values, attr=None) -> None: if not isinstance(values, np.ndarray): raise TypeError("Need to pass a numpy array of float64 dtype as values") if not values.dtype == "float64": raise TypeError("Need to pass a numpy array of float64 dtype as values") self.data = values self.attr = attr
@classmethod def _from_sequence(cls, scalars, *, dtype=None, copy=False): if not copy: data = np.asarray(scalars, dtype="float64") else: data = np.array(scalars, dtype="float64", copy=copy) return cls(data)
def __getitem__(self, item): if isinstance(item, numbers.Integral): return self.data[item] else: # slice, list-like, mask item = pd.api.indexers.check_array_indexer(self, item) return type(self)(self.data[item], self.attr)
def __len__(self) -> int: return len(self.data)
def isna(self): return np.isnan(self.data)
def take(self, indexer, allow_fill=False, fill_value=None): from pandas.api.extensions import take
data = self.data if allow_fill and fill_value is None: fill_value = self.dtype.na_value
result = take(data, indexer, fill_value=fill_value, allow_fill=allow_fill) return type(self)(result, self.attr)
def copy(self): return type(self)(self.data.copy(), self.attr)
@classmethod def _concat_same_type(cls, to_concat): data = np.concatenate([x.data for x in to_concat]) attr = to_concat[0].attr if len(to_concat) else None return cls(data, attr)123456789101112131415161718192021222324252627282930313233import numpy as np
import pandas as pdimport pandas._testing as tmfrom pandas.tests.extension.array_with_attr import FloatAttrArray
def test_concat_with_all_na(): # https://github.com/pandas-dev/pandas/pull/47762 # ensure that attribute of the column array is preserved (when it gets # preserved in reindexing the array) during merge/concat arr = FloatAttrArray(np.array([np.nan, np.nan], dtype="float64"), attr="test")
df1 = pd.DataFrame({"col": arr, "key": [0, 1]}) df2 = pd.DataFrame({"key": [0, 1], "col2": [1, 2]}) result = pd.merge(df1, df2, on="key") expected = pd.DataFrame({"col": arr, "key": [0, 1], "col2": [1, 2]}) tm.assert_frame_equal(result, expected) assert result["col"].array.attr == "test"
df1 = pd.DataFrame({"col": arr, "key": [0, 1]}) df2 = pd.DataFrame({"key": [0, 2], "col2": [1, 2]}) result = pd.merge(df1, df2, on="key") expected = pd.DataFrame({"col": arr.take([0]), "key": [0], "col2": [1]}) tm.assert_frame_equal(result, expected) assert result["col"].array.attr == "test"
result = pd.concat([df1.set_index("key"), df2.set_index("key")], axis=1) expected = pd.DataFrame( {"col": arr.take([0, 1, -1]), "col2": [1, np.nan, 2], "key": [0, 1, 2]} ).set_index("key") tm.assert_frame_equal(result, expected) assert result["col"].array.attr == "test"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131"""Base test suite for extension arrays.
These tests are intended for third-party libraries to subclass to validatethat their extension arrays and dtypes satisfy the interface. Moving orrenaming the tests should not be done lightly.
Libraries are expected to implement a few pytest fixtures to provide datafor the tests. The fixtures may be located in either
* The same module as your test class.* A ``conftest.py`` in the same directory as your test class.
The full list of fixtures may be found in the ``conftest.py`` next to thisfile.
.. code-block:: python
import pytest from pandas.tests.extension.base import BaseDtypeTests
@pytest.fixture def dtype(): return MyDtype()
class TestMyDtype(BaseDtypeTests): pass
Your class ``TestDtype`` will inherit all the tests defined on``BaseDtypeTests``. pytest's fixture discover will supply your ``dtype``wherever the test requires it. You're free to implement additional tests.
"""from pandas.tests.extension.base.accumulate import BaseAccumulateTestsfrom pandas.tests.extension.base.casting import BaseCastingTestsfrom pandas.tests.extension.base.constructors import BaseConstructorsTestsfrom pandas.tests.extension.base.dim2 import ( # noqa: F401 Dim2CompatTests, NDArrayBacked2DTests,)from pandas.tests.extension.base.dtype import BaseDtypeTestsfrom pandas.tests.extension.base.getitem import BaseGetitemTestsfrom pandas.tests.extension.base.groupby import BaseGroupbyTestsfrom pandas.tests.extension.base.index import BaseIndexTestsfrom pandas.tests.extension.base.interface import BaseInterfaceTestsfrom pandas.tests.extension.base.io import BaseParsingTestsfrom pandas.tests.extension.base.methods import BaseMethodsTestsfrom pandas.tests.extension.base.missing import BaseMissingTestsfrom pandas.tests.extension.base.ops import ( # noqa: F401 BaseArithmeticOpsTests, BaseComparisonOpsTests, BaseOpsUtil, BaseUnaryOpsTests,)from pandas.tests.extension.base.printing import BasePrintingTestsfrom pandas.tests.extension.base.reduce import BaseReduceTestsfrom pandas.tests.extension.base.reshaping import BaseReshapingTestsfrom pandas.tests.extension.base.setitem import BaseSetitemTests
# One test class that you can inherit as an alternative to inheriting all the# test classes above.# Note 1) this excludes Dim2CompatTests and NDArrayBacked2DTests.# Note 2) this uses BaseReduceTests and and _not_ BaseBooleanReduceTests,# BaseNoReduceTests, or BaseNumericReduceTestsclass ExtensionTests( BaseAccumulateTests, BaseCastingTests, BaseConstructorsTests, BaseDtypeTests, BaseGetitemTests, BaseGroupbyTests, BaseIndexTests, BaseInterfaceTests, BaseParsingTests, BaseMethodsTests, BaseMissingTests, BaseArithmeticOpsTests, BaseComparisonOpsTests, BaseUnaryOpsTests, BasePrintingTests, BaseReduceTests, BaseReshapingTests, BaseSetitemTests, Dim2CompatTests,): pass
def __getattr__(name: str): import warnings
if name == "BaseNoReduceTests": warnings.warn( "BaseNoReduceTests is deprecated and will be removed in a " "future version. Use BaseReduceTests and override " "`_supports_reduction` instead.", FutureWarning, ) from pandas.tests.extension.base.reduce import BaseNoReduceTests
return BaseNoReduceTests
elif name == "BaseNumericReduceTests": warnings.warn( "BaseNumericReduceTests is deprecated and will be removed in a " "future version. Use BaseReduceTests and override " "`_supports_reduction` instead.", FutureWarning, ) from pandas.tests.extension.base.reduce import BaseNumericReduceTests
return BaseNumericReduceTests
elif name == "BaseBooleanReduceTests": warnings.warn( "BaseBooleanReduceTests is deprecated and will be removed in a " "future version. Use BaseReduceTests and override " "`_supports_reduction` instead.", FutureWarning, ) from pandas.tests.extension.base.reduce import BaseBooleanReduceTests
return BaseBooleanReduceTests
raise AttributeError( f"module 'pandas.tests.extension.base' has no attribute '{name}'" )123456789101112131415161718192021222324252627282930313233343536373839import pytest
import pandas as pdimport pandas._testing as tm
class BaseAccumulateTests: """ Accumulation specific tests. Generally these only make sense for numeric/boolean operations. """
def _supports_accumulation(self, ser: pd.Series, op_name: str) -> bool: # Do we expect this accumulation to be supported for this dtype? # We default to assuming "no"; subclass authors should override here. return False
def check_accumulate(self, ser: pd.Series, op_name: str, skipna: bool): try: alt = ser.astype("float64") except TypeError: # e.g. Period can't be cast to float64 alt = ser.astype(object)
result = getattr(ser, op_name)(skipna=skipna) expected = getattr(alt, op_name)(skipna=skipna) tm.assert_series_equal(result, expected, check_dtype=False)
@pytest.mark.parametrize("skipna", [True, False]) def test_accumulate_series(self, data, all_numeric_accumulations, skipna): op_name = all_numeric_accumulations ser = pd.Series(data)
if self._supports_accumulation(ser, op_name): self.check_accumulate(ser, op_name, skipna) else: with pytest.raises((NotImplementedError, TypeError)): # TODO: require TypeError for things that will _never_ work? getattr(ser, op_name)(skipna=skipna)12class BaseExtensionTests: passlib/python3.12/site-packages/pandas/tests/api/__init__.pyAdded
lib/python3.12/site-packages/pandas/tests/api/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/api/__pycache__/test_types.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/api/test_api.pyAdded+383
lib/python3.12/site-packages/pandas/tests/api/test_types.pyAdded+62
lib/python3.12/site-packages/pandas/tests/construction/__init__.pyAdded
lib/python3.12/site-packages/pandas/tests/construction/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/construction/__pycache__/test_extract_array.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/construction/test_extract_array.pyAdded+18
lib/python3.12/site-packages/pandas/tests/extension/__init__.pyAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/conftest.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_categorical.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_common.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_datetime.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_extension.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_interval.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_masked.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_numpy.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_period.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_sparse.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/__pycache__/test_string.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__init__.pyAdded+6
lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__pycache__/array.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/__pycache__/test_array_with_attr.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/array.pyAdded+89
lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/test_array_with_attr.pyAdded+33
lib/python3.12/site-packages/pandas/tests/extension/base/__init__.pyAdded+131
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/accumulate.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/base.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/casting.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/constructors.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/dim2.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/dtype.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/getitem.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/groupby.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/index.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/interface.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/io.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/methods.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/missing.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/ops.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/printing.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/reduce.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/reshaping.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/__pycache__/setitem.cpython-312.pycAdded
lib/python3.12/site-packages/pandas/tests/extension/base/accumulate.pyAdded+39
lib/python3.12/site-packages/pandas/tests/extension/base/base.pyAdded+2