__init__.py 2.1 KB

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