You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "sjperkins (via GitHub)" <gi...@apache.org> on 2023/02/10 11:53:56 UTC

[GitHub] [arrow] sjperkins commented on a diff in pull request #33802: GH-33801: [Python] Expose C++ ExtensionTypes/ExtensionArrays in pyarrow

sjperkins commented on code in PR #33802:
URL: https://github.com/apache/arrow/pull/33802#discussion_r1102675045


##########
python/pyarrow/tests/test_cython.py:
##########
@@ -163,6 +163,40 @@ def test_cython_api(tmpdir):
                               env=subprocess_env)
 
 
+@pytest.mark.cython
+def test_extension_type(tmpdir):

Review Comment:
   Moved to `test_extension_type.py`



##########
python/pyarrow/tests/test_cython.py:
##########
@@ -163,6 +163,40 @@ def test_cython_api(tmpdir):
                               env=subprocess_env)
 
 
+@pytest.mark.cython
+def test_extension_type(tmpdir):
+    with tmpdir.as_cwd():
+        # Set up temporary workspace
+        pyx_file = 'extensions.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__('extensions')
+
+    uuid_type = mod._make_uuid_type()
+    assert uuid_type.extension_name == "uuid"
+    assert uuid_type.storage_type == pa.binary(16)
+
+    array = mod._make_uuid_array()

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org