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


##########
python/pyarrow/tests/test_convert_builtin.py:
##########
@@ -2457,14 +2457,29 @@ def test_array_from_pylist_offset_overflow():
     )
 ])
 def test_array_accepts_pyarrow_scalar(seq, data, scalar_data, value_type):
-    if type(seq(scalar_data)) == set:
-        pytest.skip("TODO: The elements in the set get reordered.")
     expect = pa.array(data, type=value_type)
     result = pa.array(seq(scalar_data))
-    assert expect.equals(result)
+
+    if type(seq(scalar_data)) == set:
+        try:
+            import pyarrow.compute as pc
+            expect = [expect[a] for a in 
pc.array_sort_indices(expect).to_pylist()]
+            result = [result[a] for a in 
pc.array_sort_indices(result).to_pylist()]
+            expect == result
+        except pa.lib.ArrowNotImplementedError:
+            set(expect) == set(result)

Review Comment:
   There is always a case that doesn't fit in this PR 🤣  
   
   ```python
   TypeError: unhashable type: 'list'
   TypeError: unhashable type: 'dict'
   ```
   
   I can do `try-except` and take the items of the lists in the case of a 
`TypeError` from above (in case of ListType and StructType as `to_pylist()` 
returns a dictionary in a list).



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to