__init__.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. """
  2. Base test suite for extension arrays.
  3. These tests are intended for third-party libraries to subclass to validate
  4. that their extension arrays and dtypes satisfy the interface. Moving or
  5. renaming the tests should not be done lightly.
  6. Libraries are expected to implement a few pytest fixtures to provide data
  7. for the tests. The fixtures may be located in either
  8. * The same module as your test class.
  9. * A ``conftest.py`` in the same directory as your test class.
  10. The full list of fixtures may be found in the ``conftest.py`` next to this
  11. file.
  12. .. code-block:: python
  13. import pytest
  14. from pandas.tests.extension.base import BaseDtypeTests
  15. @pytest.fixture
  16. def dtype():
  17. return MyDtype()
  18. class TestMyDtype(BaseDtypeTests):
  19. pass
  20. Your class ``TestDtype`` will inherit all the tests defined on
  21. ``BaseDtypeTests``. pytest's fixture discover will supply your ``dtype``
  22. wherever the test requires it. You're free to implement additional tests.
  23. All the tests in these modules use ``self.assert_frame_equal`` or
  24. ``self.assert_series_equal`` for dataframe or series comparisons. By default,
  25. they use the usual ``pandas.testing.assert_frame_equal`` and
  26. ``pandas.testing.assert_series_equal``. You can override the checks used
  27. by defining the staticmethods ``assert_frame_equal`` and
  28. ``assert_series_equal`` on your base test class.
  29. """
  30. from pandas.tests.extension.base.accumulate import BaseAccumulateTests # noqa
  31. from pandas.tests.extension.base.casting import BaseCastingTests # noqa
  32. from pandas.tests.extension.base.constructors import BaseConstructorsTests # noqa
  33. from pandas.tests.extension.base.dim2 import ( # noqa
  34. Dim2CompatTests,
  35. NDArrayBacked2DTests,
  36. )
  37. from pandas.tests.extension.base.dtype import BaseDtypeTests # noqa
  38. from pandas.tests.extension.base.getitem import BaseGetitemTests # noqa
  39. from pandas.tests.extension.base.groupby import BaseGroupbyTests # noqa
  40. from pandas.tests.extension.base.index import BaseIndexTests # noqa
  41. from pandas.tests.extension.base.interface import BaseInterfaceTests # noqa
  42. from pandas.tests.extension.base.io import BaseParsingTests # noqa
  43. from pandas.tests.extension.base.methods import BaseMethodsTests # noqa
  44. from pandas.tests.extension.base.missing import BaseMissingTests # noqa
  45. from pandas.tests.extension.base.ops import ( # noqa
  46. BaseArithmeticOpsTests,
  47. BaseComparisonOpsTests,
  48. BaseOpsUtil,
  49. BaseUnaryOpsTests,
  50. )
  51. from pandas.tests.extension.base.printing import BasePrintingTests # noqa
  52. from pandas.tests.extension.base.reduce import ( # noqa
  53. BaseBooleanReduceTests,
  54. BaseNoReduceTests,
  55. BaseNumericReduceTests,
  56. )
  57. from pandas.tests.extension.base.reshaping import BaseReshapingTests # noqa
  58. from pandas.tests.extension.base.setitem import BaseSetitemTests # noqa