You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/03/12 03:00:22 UTC

[arrow] branch master updated: ARROW-3735: [Python] Add test for calling cast() with None

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ddad36  ARROW-3735: [Python] Add test for calling cast() with None
7ddad36 is described below

commit 7ddad36e0fd3707f0a893bbfda3e2f9149909708
Author: Korn, Uwe <Uw...@blue-yonder.com>
AuthorDate: Mon Mar 11 22:00:12 2019 -0500

    ARROW-3735: [Python] Add test for calling cast() with None
    
    Author: Korn, Uwe <Uw...@blue-yonder.com>
    
    Closes #3862 from xhochy/ARROW-3735 and squashes the following commits:
    
    0f91e5f59 <Korn, Uwe> ARROW-3735:  Add test for calling cast() with None
---
 python/pyarrow/tests/test_array.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py
index 0090a1c..eabc875 100644
--- a/python/pyarrow/tests/test_array.py
+++ b/python/pyarrow/tests/test_array.py
@@ -524,6 +524,18 @@ def test_cast_integers_safe():
             in_arr.cast(out_type)
 
 
+def test_cast_none():
+    # ARROW-3735: Ensure that calling cast(None) doesn't segfault.
+    arr = pa.array([1, 2, 3])
+    col = pa.column('foo', [arr])
+
+    with pytest.raises(TypeError):
+        arr.cast(None)
+
+    with pytest.raises(TypeError):
+        col.cast(None)
+
+
 def test_cast_column():
     arrays = [pa.array([1, 2, 3]), pa.array([4, 5, 6])]