test_extension.py 559 B

1234567891011121314151617181920212223242526
  1. """
  2. Tests for behavior if an author does *not* implement EA methods.
  3. """
  4. import numpy as np
  5. import pytest
  6. from pandas.core.arrays import ExtensionArray
  7. class MyEA(ExtensionArray):
  8. def __init__(self, values) -> None:
  9. self._values = values
  10. @pytest.fixture
  11. def data():
  12. arr = np.arange(10)
  13. return MyEA(arr)
  14. class TestExtensionArray:
  15. def test_errors(self, data, all_arithmetic_operators):
  16. # invalid ops
  17. op_name = all_arithmetic_operators
  18. with pytest.raises(AttributeError):
  19. getattr(data, op_name)