Upload hf_env/lib/python3.14/site-packages/pandas/tests/extension/test_extension.py with huggingface_hub
Browse files
hf_env/lib/python3.14/site-packages/pandas/tests/extension/test_extension.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tests for behavior if an author does *not* implement EA methods.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import numpy as np
|
| 6 |
+
import pytest
|
| 7 |
+
|
| 8 |
+
from pandas.core.arrays import ExtensionArray
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class MyEA(ExtensionArray):
|
| 12 |
+
def __init__(self, values) -> None:
|
| 13 |
+
self._values = values
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
@pytest.fixture
|
| 17 |
+
def data():
|
| 18 |
+
arr = np.arange(10)
|
| 19 |
+
return MyEA(arr)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class TestExtensionArray:
|
| 23 |
+
def test_errors(self, data, all_arithmetic_operators):
|
| 24 |
+
# invalid ops
|
| 25 |
+
op_name = all_arithmetic_operators
|
| 26 |
+
with pytest.raises(AttributeError):
|
| 27 |
+
getattr(data, op_name)
|