SIGN IN SIGN UP
apache / arrow UNCLAIMED

Apache Arrow is the universal columnar format and multi-language toolbox for fast data interchange and in-memory analytics

0 0 9 C++
ARROW-17016: [C++][Python] Move Arrow Python C++ tests into Cython (#14117) This PR tries to connect the PyArrow C++ tests with PyArrow tests so they can all be run from `pytest`. This will remove GoogleTest as a dependency for PyArrow and therefore a change is needed in the C++ tests so they return a Status which can then be checked through Cython/Python. Example of pytest run: ``` pyarrow/tests/test_cpp_internals.py::test_owned_ref_moves PASSED pyarrow/tests/test_cpp_internals.py::test_owned_ref_nogil_moves PASSED pyarrow/tests/test_cpp_internals.py::test_check_pyerror_status PASSED pyarrow/tests/test_cpp_internals.py::test_check_pyerror_status_nogil PASSED pyarrow/tests/test_cpp_internals.py::test_restore_pyerror_basics PASSED pyarrow/tests/test_cpp_internals.py::test_pybuffer_invalid_input_object PASSED pyarrow/tests/test_cpp_internals.py::test_pybuffer_numpy_array PASSED pyarrow/tests/test_cpp_internals.py::test_numpybuffer_numpy_array PASSED pyarrow/tests/test_cpp_internals.py::test_python_decimal_to_string PASSED pyarrow/tests/test_cpp_internals.py::test_infer_precision_and_scale PASSED pyarrow/tests/test_cpp_internals.py::test_infer_precision_and_negative_scale PASSED pyarrow/tests/test_cpp_internals.py::test_infer_all_leading_zeros PASSED pyarrow/tests/test_cpp_internals.py::test_infer_all_leading_zeros_exponential_notation_positive PASSED pyarrow/tests/test_cpp_internals.py::test_infer_all_leading_zeros_exponential_notation_negative PASSED pyarrow/tests/test_cpp_internals.py::test_object_block_write_fails PASSED pyarrow/tests/test_cpp_internals.py::test_mixed_type_fails PASSED pyarrow/tests/test_cpp_internals.py::test_from_python_decimal_rescale_not_truncateable PASSED pyarrow/tests/test_cpp_internals.py::test_from_python_decimal_rescale_truncateable PASSED pyarrow/tests/test_cpp_internals.py::test_from_python_negative_decimal_rescale PASSED pyarrow/tests/test_cpp_internals.py::test_decimal128_from_python_integer PASSED pyarrow/tests/test_cpp_internals.py::test_decimal256_from_python_integer PASSED pyarrow/tests/test_cpp_internals.py::test_decimal128_overflow_fails PASSED pyarrow/tests/test_cpp_internals.py::test_decimal256_overflow_fails PASSED pyarrow/tests/test_cpp_internals.py::test_none_and_nan PASSED pyarrow/tests/test_cpp_internals.py::test_mixed_precision_and_scale PASSED pyarrow/tests/test_cpp_internals.py::test_mixed_precision_and_scale_sequence_convert PASSED pyarrow/tests/test_cpp_internals.py::test_simple_inference PASSED pyarrow/tests/test_cpp_internals.py::test_update_with_nan PASSED ``` Lead-authored-by: Alenka Frim <frim.alenka@gmail.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-10-03 18:45:00 +02:00
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# cython: profile=False, binding=True
# distutils: language = c++
from pyarrow.includes.common cimport *
from pyarrow.includes.libarrow cimport *
from pyarrow.lib cimport check_status
from pyarrow.lib import frombytes
cdef class CppTestCase:
"""
A simple wrapper for a C++ test case.
"""
cdef:
CTestCase c_case
@staticmethod
cdef wrap(CTestCase c_case):
cdef:
CppTestCase obj
obj = CppTestCase.__new__(CppTestCase)
obj.c_case = c_case
return obj
@property
def name(self):
return frombytes(self.c_case.name)
def __repr__(self):
return f"<{self.__class__.__name__} {self.name!r}>"
def __call__(self):
check_status(self.c_case.func())
def get_cpp_tests():
"""
Get a list of C++ test cases.
"""
cases = []
c_cases = GetCppTestCases()
for c_case in c_cases:
cases.append(CppTestCase.wrap(c_case))
return cases