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

[GitHub] [arrow] AlenkaF commented on a diff in pull request #34275: GH-21761: [Python] Change array constructor to accept pyarrow array

AlenkaF commented on code in PR #34275:
URL: https://github.com/apache/arrow/pull/34275#discussion_r1113950357


##########
python/pyarrow/tests/test_array.py:
##########
@@ -3381,3 +3381,15 @@ def test_struct_array_sort():
         {"a": 5, "b": "foo"},
         None
     ]
+
+
+def test_array_accepts_pyarrow_array():
+    arr = pa.array([1, 2, 3])
+    result = pa.array(arr)
+
+    assert arr == result
+
+    arr_uint = pa.array([1, 2, 3], type=pa.uint8())
+    result = pa.array(arr, type=pa.uint8())

Review Comment:
   You mean adding a test where `arr` type and type passed is different? I do not think I follow - it should be the case here (`arr` is of type int64 and the test passes uint8 type to check the casting?)
   
   I will rename `arr_uint` to `expected` just to make it clearer.



-- 
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