Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
import pytest
import scyjava as sj
import xarray

# -- Fixtures --

Expand All @@ -13,6 +14,11 @@ def arr():
return empty_array


@pytest.fixture(scope="module")
def xarr(arr):
return xarray.DataArray(arr, name="test_xarray")


@pytest.fixture(scope="module")
def results_table(ij):
if ij.legacy and ij.legacy.isActive():
Expand Down Expand Up @@ -141,6 +147,19 @@ def test_window_to_numpy_converts_active_image_to_xarray(ij, arr):
assert (arr == new_arr.values).all


def test_linked_dataset_convertsion_to_xarray(ij, xarr):
ensure_legacy_enabled(ij)
Copy link

Copilot AI Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'convertsion' in the test function name is misspelled; consider renaming it to 'conversion'.

Suggested change
def test_linked_dataset_convertsion_to_xarray(ij, xarr):
ensure_legacy_enabled(ij)
def test_linked_dataset_conversion_to_xarray(ij, xarr):

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Do you respond to replies? Good catch on the typo, but the suggestion deletes a line that is necessary.

ensure_gui_available(ij)

# get a dataset, linked to an ImagePlus
dataset = ij.py.to_dataset(arr)
ij.ui().show(dataset)

# convert the image data to xarray
xarr_out = ij.py.to_xarray(dataset)
assert xarr_out.name == "test_xarray"


def test_functions_throw_warning_if_legacy_not_enabled(ij):
ensure_legacy_disabled(ij)

Expand Down
Loading