hyb
2025-10-24 43c4449e6c9231446895ad26d169825ca7a65c9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"""
Base test suite for extension arrays.
 
These tests are intended for third-party libraries to subclass to validate
that their extension arrays and dtypes satisfy the interface. Moving or
renaming the tests should not be done lightly.
 
Libraries are expected to implement a few pytest fixtures to provide data
for 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 this
file.
 
.. 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 BaseAccumulateTests
from pandas.tests.extension.base.casting import BaseCastingTests
from pandas.tests.extension.base.constructors import BaseConstructorsTests
from pandas.tests.extension.base.dim2 import (  # noqa: F401
    Dim2CompatTests,
    NDArrayBacked2DTests,
)
from pandas.tests.extension.base.dtype import BaseDtypeTests
from pandas.tests.extension.base.getitem import BaseGetitemTests
from pandas.tests.extension.base.groupby import BaseGroupbyTests
from pandas.tests.extension.base.index import BaseIndexTests
from pandas.tests.extension.base.interface import BaseInterfaceTests
from pandas.tests.extension.base.io import BaseParsingTests
from pandas.tests.extension.base.methods import BaseMethodsTests
from pandas.tests.extension.base.missing import BaseMissingTests
from pandas.tests.extension.base.ops import (  # noqa: F401
    BaseArithmeticOpsTests,
    BaseComparisonOpsTests,
    BaseOpsUtil,
    BaseUnaryOpsTests,
)
from pandas.tests.extension.base.printing import BasePrintingTests
from pandas.tests.extension.base.reduce import BaseReduceTests
from pandas.tests.extension.base.reshaping import BaseReshapingTests
from 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 BaseNumericReduceTests
class 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}'"
    )