diff --git a/python/pyarrow/interchange/column.py b/python/pyarrow/interchange/column.py index f80c586ff95..2ecc690b80e 100644 --- a/python/pyarrow/interchange/column.py +++ b/python/pyarrow/interchange/column.py @@ -313,7 +313,13 @@ def _dtype_from_arrowdtype( kind = DtypeKind.CATEGORICAL arr = self._col indices_dtype = arr.indices.type - _, f_string = _PYARROW_KINDS.get(indices_dtype) + mapping = _PYARROW_KINDS.get(indices_dtype) + if mapping is None: + raise ValueError( + f"Dictionary index data type {indices_dtype} " + "not supported by interchange protocol" + ) + _, f_string = mapping return kind, bit_width, f_string, Endianness.NATIVE else: kind, f_string = _PYARROW_KINDS.get(dtype, (None, None)) diff --git a/python/pyarrow/tests/test_feather.py b/python/pyarrow/tests/test_feather.py index 054bf920b26..d2b59fddebb 100644 --- a/python/pyarrow/tests/test_feather.py +++ b/python/pyarrow/tests/test_feather.py @@ -72,11 +72,12 @@ def setup_module(module): def teardown_module(module): - for path in TEST_FILES: - try: - os.remove(path) - except os.error: - pass + if TEST_FILES is not None: + for path in TEST_FILES: + try: + os.remove(path) + except os.error: + pass @pytest.mark.pandas