Skip to content

Commit f1522ea

Browse files
committed
update test
1 parent 91ab583 commit f1522ea

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/integration/test_merge_imzml_integration.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from tempfile import TemporaryDirectory
44

55
import numpy as np
6+
import xarray
67

78
from depiction.misc.integration_test_utils import IntegrationTestUtils
89
from depiction.persistence import ImzmlReadFile, ImzmlModeEnum, ImzmlWriteFile
@@ -39,12 +40,14 @@ def test_merge_continuous(self) -> None:
3940

4041
with ImzmlReadFile(self.mock_output_file_path).reader() as reader:
4142
spectra = reader.get_spectra([0, 1, 2])
42-
coordinates = reader.coordinates
43+
coordinates = reader.coordinates_array_2d
4344
self.assertEqual(ImzmlModeEnum.CONTINUOUS, reader.imzml_mode)
4445

4546
np.testing.assert_array_equal(np.array([[100, 200, 300], [100, 200, 300], [100, 200, 300]]), spectra[0])
4647
np.testing.assert_array_equal(np.array([[1, 2, 3], [2, 2, 2], [4, 5, 6]]), spectra[1])
47-
np.testing.assert_array_equal(np.array([[0, 0, 1], [0, 1, 1], [5, 1, 1]]), coordinates)
48+
xarray.testing.assert_equal(
49+
xarray.DataArray([[0, 0], [0, 1], [5, 1]], dims=("i", "d"), coords={"d": ["x", "y"]}), coordinates
50+
)
4851

4952
def test_merge_processed(self) -> None:
5053
IntegrationTestUtils.populate_test_file(
@@ -69,7 +72,7 @@ def test_merge_processed(self) -> None:
6972

7073
with ImzmlReadFile(self.mock_output_file_path).reader() as reader:
7174
spectra = reader.get_spectra([0, 1, 2])
72-
coordinates = reader.coordinates
75+
coordinates = reader.coordinates_array_2d
7376
self.assertEqual(ImzmlModeEnum.PROCESSED, reader.imzml_mode)
7477

7578
self.assertEqual(3, len(spectra[0]))
@@ -80,8 +83,9 @@ def test_merge_processed(self) -> None:
8083
np.testing.assert_array_equal(np.array([1, 2, 3]), spectra[1][0])
8184
np.testing.assert_array_equal(np.array([2, 2]), spectra[1][1])
8285
np.testing.assert_array_equal(np.array([3, 3, 3, 3]), spectra[1][2])
83-
84-
np.testing.assert_array_equal(np.array([[0, 0, 1], [0, 1, 1], [5, 1, 1]]), coordinates)
86+
xarray.testing.assert_equal(
87+
xarray.DataArray([[0, 0], [0, 1], [5, 1]], dims=("i", "d"), coords={"d": ["x", "y"]}), coordinates
88+
)
8589

8690

8791
if __name__ == "__main__":

0 commit comments

Comments
 (0)