allure-framework / allure-python

Allure integrations for Python test frameworks
https://allurereport.org/
Apache License 2.0
730 stars 237 forks source link

Not implemented type for Arrow list to pandas: fixed_size_binary[16] #811

Open jbShi1017 opened 7 months ago

jbShi1017 commented 7 months ago

I'm submitting a ...

What is the current behavior?

using pandas dataframe with dtype as pd.ArrowDtype(pa.list_(pa.binary(16)) in pytest

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

test.py:

import pytest
from uuid import UUID
import pandas as pd
import pyarrow as pa

uuid=UUID('5d212a78-cc48-e3b1-4235-b4d91473ee87').bytes
df=pd.DataFrame({'a': [[uuid, uuid, uuid], [uuid,uuid, uuid]]},dtype=pd.ArrowDtype(pa.list_(pa.binary(16))))

class TestUuid():

    @pytest.mark.parametrize("data",[df])
    def test_uuid(self,data):
        pass

run codes: pytest ./test.py --alluredir=allure-results

result:

(py311) PS D:\code\test> pytest ./test.py --alluredir=allure-results
======================================================================================================== test session starts ========================================================================================================
platform win32 -- Python 3.11.5, pytest-8.1.1, pluggy-1.5.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: D:\code\test
plugins: allure-pytest-2.13.5, benchmark-4.0.0, html-4.1.1, metadata-3.0.0, ordering-0.6, rerunfailures-13.0, xdist-3.5.0
collected 1 item                                                                                                                                                                                                                     

test.py E                                                                                                                                                                                                                      [100%]

============================================================================================================== ERRORS ===============================================================================================================
____________________________________________________________________________________________ ERROR at setup of TestUuid.test_uuid[data0] ____________________________________________________________________________________________

self = <allure_pytest.listener.AllureListener object at 0x0000024B939297D0>, item = <Function test_uuid[data0]>

    @pytest.hookimpl(hookwrapper=True)
    def pytest_runtest_setup(self, item):
        if not self._cache.get(item.nodeid):
            uuid = self._cache.push(item.nodeid)
            test_result = TestResult(name=item.name, uuid=uuid, start=now(), stop=now())
            self.allure_logger.schedule_test(uuid, test_result)
        yield
        self._update_fixtures_children(item)
        uuid = self._cache.get(item.nodeid)
        test_result = self.allure_logger.get_test(uuid)
        params = self.__get_pytest_params(item)
        param_id = self.__get_pytest_param_id(item)
        test_result.name = allure_name(item, params, param_id)
        full_name = allure_full_name(item)
        test_result.fullName = full_name
        test_result.testCaseId = md5(full_name)
        test_result.description = allure_description(item)
        test_result.descriptionHtml = allure_description_html(item)
        current_param_names = [param.name for param in test_result.parameters]
>       test_result.parameters.extend([
            Parameter(name=name, value=represent(value))
            for name, value in params.items()
            if name not in current_param_names
        ])

D:\software\Anaconda3\envs\py311\Lib\site-packages\allure_pytest\listener.py:116:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
D:\software\Anaconda3\envs\py311\Lib\site-packages\allure_pytest\listener.py:117: in <listcomp>
    Parameter(name=name, value=represent(value))
D:\software\Anaconda3\envs\py311\Lib\site-packages\allure_commons\utils.py:93: in represent
    return repr(item)
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\core\frame.py:1214: in __repr__
    return self.to_string(**repr_params)
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\util\_decorators.py:333: in wrapper
    return func(*args, **kwargs)
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\core\frame.py:1394: in to_string
    return fmt.DataFrameRenderer(formatter).to_string(
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:962: in to_string
    string = string_formatter.to_string()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\string.py:29: in to_string
    text = self._get_string_representation()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\string.py:44: in _get_string_representation
    strcols = self._get_strcols()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\string.py:35: in _get_strcols
    strcols = self.fmt.get_strcols()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:476: in get_strcols
    strcols = self._get_strcols_without_index()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:740: in _get_strcols_without_index
    fmt_values = self.format_col(i)
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:754: in format_col
    return format_array(
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:1161: in format_array
    return fmt_obj.get_result()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:1194: in get_result
    fmt_values = self._format_strings()
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\io\formats\format.py:1528: in _format_strings
    array = np.asarray(values, dtype=object)
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\core\arrays\arrow\array.py:663: in __array__
    return self.to_numpy(dtype=dtype)
D:\software\Anaconda3\envs\py311\Lib\site-packages\pandas\core\arrays\arrow\array.py:1399: in to_numpy
    result = data._pa_array.to_numpy()
pyarrow\table.pxi:509: in pyarrow.lib.ChunkedArray.to_numpy
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   pyarrow.lib.ArrowNotImplementedError: Not implemented type for Arrow list to pandas: fixed_size_binary[16]

pyarrow\error.pxi:91: ArrowNotImplementedError
========================================================================================================= warnings summary ========================================================================================================== 
test.py::TestUuid::test_uuid[data0]
  D:\software\Anaconda3\envs\py311\Lib\site-packages\_pytest\runner.py:240: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
  Plugin: allure_listener, Hook: pytest_runtest_setup
  ArrowNotImplementedError: Not implemented type for Arrow list to pandas: fixed_size_binary[16]
  For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================================================================================== short test summary info ====================================================================================================== 
ERROR test.py::TestUuid::test_uuid[data0] - pyarrow.lib.ArrowNotImplementedError: Not implemented type for Arrow list to pandas: fixed_size_binary[16]
==================================================================================================== 1 warning, 1 error in 0.62s ==================================================================================================== 

What is the expected behavior?

no error raise

Please tell us about your environment: