Skip to content

Commit 722ca9b

Browse files
committed
TST: test inspect.getmembers(Series)
1 parent 3217b43 commit 722ca9b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

pandas/core/frame.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,14 @@ class DataFrame(NDFrame, OpsMixin):
488488
_internal_names_set = {"columns", "index"} | NDFrame._internal_names_set
489489
_typ = "dataframe"
490490
_HANDLED_TYPES = (Series, Index, ExtensionArray, np.ndarray)
491+
_accessors: Set[str] = {"sparse"}
492+
_hidden_attrs: FrozenSet[str] = NDFrame._hidden_attrs | frozenset([])
493+
_constructor_sliced: Type[Series] = Series
491494

492495
@property
493496
def _constructor(self) -> Type[DataFrame]:
494497
return DataFrame
495498

496-
_constructor_sliced: Type[Series] = Series
497-
_hidden_attrs: FrozenSet[str] = NDFrame._hidden_attrs | frozenset([])
498-
_accessors: Set[str] = {"sparse"}
499-
500499
@property
501500
def _constructor_expanddim(self):
502501
# GH#31549 raising NotImplementedError on a property causes trouble

pandas/core/generic.py

-8
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,6 @@ def _constructor(self: FrameOrSeries) -> Type[FrameOrSeries]:
375375
"""
376376
raise AbstractMethodError(self)
377377

378-
@property
379-
def _constructor_sliced(self):
380-
"""
381-
Used when a manipulation result has one lower dimension(s) as the
382-
original, such as DataFrame single columns slicing.
383-
"""
384-
raise AbstractMethodError(self)
385-
386378
@property
387379
def _constructor_expanddim(self):
388380
"""

pandas/tests/series/test_api.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pydoc
2+
import inspect
23

34
import numpy as np
45
import pytest
56

67
import pandas as pd
8+
from pandas.util._test_decorators import skip_if_no
79
from pandas import DataFrame, Index, Series, date_range
810
import pandas._testing as tm
911

@@ -167,3 +169,10 @@ def test_attrs(self):
167169
s.attrs["version"] = 1
168170
result = s + 1
169171
assert result.attrs == {"version": 1}
172+
173+
@skip_if_no("jinja2")
174+
def test_inspect_getmembers(self):
175+
# GH38740
176+
ser = Series()
177+
with tm.assert_produces_warning(None):
178+
inspect.getmembers(ser)

0 commit comments

Comments
 (0)