/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
pyarrow
/
tests
/
/usr/local/lib64/python3.6/site-packages/pyarrow/tests
mkdir
upload
Name
Size
Mode
Actions
data/
-
0755
rm
parquet/
-
0755
rm
__pycache__/
-
0755
rm
arrow_7980.py
1094
0644
edit
dl
rm
bound_function_visit_strings.pyx
2047
0644
edit
dl
rm
conftest.py
7982
0644
edit
dl
rm
deserialize_buffer.py
961
0644
edit
dl
rm
pandas_examples.py
5115
0644
edit
dl
rm
pandas_threaded_import.py
1429
0644
edit
dl
rm
pyarrow_cython_example.pyx
1951
0644
edit
dl
rm
strategies.py
12525
0644
edit
dl
rm
test_adhoc_memory_leak.py
1410
0644
edit
dl
rm
test_array.py
100157
0644
edit
dl
rm
test_builder.py
2184
0644
edit
dl
rm
test_cffi.py
13090
0644
edit
dl
rm
test_compute.py
83551
0644
edit
dl
rm
test_convert_builtin.py
71768
0644
edit
dl
rm
test_csv.py
68943
0644
edit
dl
rm
test_cuda.py
27863
0644
edit
dl
rm
test_cuda_numba_interop.py
8730
0644
edit
dl
rm
test_cython.py
5948
0644
edit
dl
rm
test_dataset.py
143023
0644
edit
dl
rm
test_deprecations.py
891
0644
edit
dl
rm
test_extension_type.py
24437
0644
edit
dl
rm
test_feather.py
23209
0644
edit
dl
rm
test_filesystem.py
2106
0644
edit
dl
rm
test_flight.py
73715
0644
edit
dl
rm
test_fs.py
54133
0644
edit
dl
rm
test_gandiva.py
14385
0644
edit
dl
rm
test_hdfs.py
13452
0644
edit
dl
rm
test_io.py
53066
0644
edit
dl
rm
test_ipc.py
31267
0644
edit
dl
rm
test_json.py
11325
0644
edit
dl
rm
test_jvm.py
15471
0644
edit
dl
rm
test_memory.py
4928
0644
edit
dl
rm
test_misc.py
4927
0644
edit
dl
rm
test_orc.py
9221
0644
edit
dl
rm
test_pandas.py
157909
0644
edit
dl
rm
test_plasma.py
44011
0644
edit
dl
rm
test_plasma_tf_op.py
3523
0644
edit
dl
rm
test_scalars.py
21074
0644
edit
dl
rm
test_schema.py
21282
0644
edit
dl
rm
test_serialization.py
42026
0644
edit
dl
rm
test_serialization_deprecated.py
1775
0644
edit
dl
rm
test_sparse_tensor.py
17436
0644
edit
dl
rm
test_strategies.py
1739
0644
edit
dl
rm
test_table.py
53168
0644
edit
dl
rm
test_tensor.py
6270
0644
edit
dl
rm
test_types.py
31487
0644
edit
dl
rm
test_util.py
1791
0644
edit
dl
rm
util.py
9011
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/pyarrow/tests/test_cython.py
(5948B)
# 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. import os import shutil import subprocess import sys import pytest import pyarrow as pa import pyarrow.tests.util as test_util here = os.path.dirname(os.path.abspath(__file__)) test_ld_path = os.environ.get('PYARROW_TEST_LD_PATH', '') if os.name == 'posix': compiler_opts = ['-std=c++11'] else: compiler_opts = [] setup_template = """if 1: from setuptools import setup from Cython.Build import cythonize import numpy as np import pyarrow as pa ext_modules = cythonize({pyx_file!r}) compiler_opts = {compiler_opts!r} custom_ld_path = {test_ld_path!r} for ext in ext_modules: # XXX required for numpy/numpyconfig.h, # included from arrow/python/api.h ext.include_dirs.append(np.get_include()) ext.include_dirs.append(pa.get_include()) ext.libraries.extend(pa.get_libraries()) ext.library_dirs.extend(pa.get_library_dirs()) if custom_ld_path: ext.library_dirs.append(custom_ld_path) ext.extra_compile_args.extend(compiler_opts) print("Extension module:", ext, ext.include_dirs, ext.libraries, ext.library_dirs) setup( ext_modules=ext_modules, ) """ def check_cython_example_module(mod): arr = pa.array([1, 2, 3]) assert mod.get_array_length(arr) == 3 with pytest.raises(TypeError, match="not an array"): mod.get_array_length(None) scal = pa.scalar(123) cast_scal = mod.cast_scalar(scal, pa.utf8()) assert cast_scal == pa.scalar("123") with pytest.raises(NotImplementedError, match="casting scalars of type int64 to type list"): mod.cast_scalar(scal, pa.list_(pa.int64())) @pytest.mark.cython def test_cython_api(tmpdir): """ Basic test for the Cython API. """ # Fail early if cython is not found import cython # noqa with tmpdir.as_cwd(): # Set up temporary workspace pyx_file = 'pyarrow_cython_example.pyx' shutil.copyfile(os.path.join(here, pyx_file), os.path.join(str(tmpdir), pyx_file)) # Create setup.py file setup_code = setup_template.format(pyx_file=pyx_file, compiler_opts=compiler_opts, test_ld_path=test_ld_path) with open('setup.py', 'w') as f: f.write(setup_code) # ARROW-2263: Make environment with this pyarrow/ package first on the # PYTHONPATH, for local dev environments subprocess_env = test_util.get_modified_env_with_pythonpath() # Compile extension module subprocess.check_call([sys.executable, 'setup.py', 'build_ext', '--inplace'], env=subprocess_env) # Check basic functionality orig_path = sys.path[:] sys.path.insert(0, str(tmpdir)) try: mod = __import__('pyarrow_cython_example') check_cython_example_module(mod) finally: sys.path = orig_path # Check the extension module is loadable from a subprocess without # pyarrow imported first. code = """if 1: import sys mod = __import__({mod_name!r}) arr = mod.make_null_array(5) assert mod.get_array_length(arr) == 5 assert arr.null_count == 5 """.format(mod_name='pyarrow_cython_example') if sys.platform == 'win32': delim, var = ';', 'PATH' else: delim, var = ':', 'LD_LIBRARY_PATH' subprocess_env[var] = delim.join( pa.get_library_dirs() + [subprocess_env.get(var, '')] ) subprocess.check_call([sys.executable, '-c', code], stdout=subprocess.PIPE, env=subprocess_env) @pytest.mark.cython def test_visit_strings(tmpdir): with tmpdir.as_cwd(): # Set up temporary workspace pyx_file = 'bound_function_visit_strings.pyx' shutil.copyfile(os.path.join(here, pyx_file), os.path.join(str(tmpdir), pyx_file)) # Create setup.py file setup_code = setup_template.format(pyx_file=pyx_file, compiler_opts=compiler_opts, test_ld_path=test_ld_path) with open('setup.py', 'w') as f: f.write(setup_code) subprocess_env = test_util.get_modified_env_with_pythonpath() # Compile extension module subprocess.check_call([sys.executable, 'setup.py', 'build_ext', '--inplace'], env=subprocess_env) sys.path.insert(0, str(tmpdir)) mod = __import__('bound_function_visit_strings') strings = ['a', 'b', 'c'] visited = [] mod._visit_strings(strings, visited.append) assert visited == strings with pytest.raises(ValueError, match="wtf"): def raise_on_b(s): if s == 'b': raise ValueError('wtf') mod._visit_strings(strings, raise_on_b)
Save
cmd:
run