Skip to content

Commit

Permalink
test: order results in test_array_flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 3, 2024
1 parent 96c68ec commit 0646fc1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ibis/backends/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,13 +1054,15 @@ def flatten_data():
@pytest.mark.notimpl(["flink"], raises=com.OperationNotDefinedError)
def test_array_flatten(backend, flatten_data, column, expected):
data = flatten_data[column]
t = ibis.memtable({column: data["data"]}, schema={column: data["type"]})
expr = t[column].flatten()
ids = range(len(data["data"]))
t = ibis.memtable(
{column: data["data"], "id": ids}, schema={column: data["type"], "id": "int64"}
)
expr = t.select("id", flat=t[column].flatten()).order_by("id")
result = backend.connection.to_pyarrow(expr)
backend.assert_series_equal(
result.to_pandas().sort_values().reset_index(drop=True),
expected.sort_values().reset_index(drop=True),
check_names=False,
backend.assert_frame_equal(
result.to_pandas(),
expected.rename("flat").to_frame().assign(id=ids)[["id", "flat"]],
)


Expand Down

0 comments on commit 0646fc1

Please sign in to comment.