|
11 | 11 | from spatial_image import SpatialImage |
12 | 12 | from spatialdata import SpatialData |
13 | 13 | from spatialdata._core.concatenate import _concatenate_tables, concatenate |
| 14 | +from spatialdata.datasets import blobs |
14 | 15 | from spatialdata.models import ( |
15 | 16 | Image2DModel, |
16 | 17 | Labels2DModel, |
17 | 18 | PointsModel, |
18 | 19 | ShapesModel, |
19 | 20 | TableModel, |
20 | 21 | ) |
21 | | -from spatialdata.transformations.operations import set_transformation |
| 22 | +from spatialdata.transformations.operations import get_transformation, set_transformation |
22 | 23 | from spatialdata.transformations.transformations import Identity, Scale |
23 | 24 |
|
24 | 25 | from tests.conftest import _get_table |
@@ -239,3 +240,18 @@ def test_set_item(full_sdata): |
239 | 240 | # trying to overwrite the file used for backing (only for images, labels and points) |
240 | 241 | with pytest.raises(ValueError): |
241 | 242 | full_sdata[name] = full_sdata[name] |
| 243 | + |
| 244 | + |
| 245 | +def test_no_shared_transformations(): |
| 246 | + """Test transformation dictionary copy for transformations not to be shared.""" |
| 247 | + sdata = blobs() |
| 248 | + element_name = "blobs_image" |
| 249 | + test_space = "test" |
| 250 | + set_transformation(sdata.images[element_name], Identity(), to_coordinate_system=test_space) |
| 251 | + |
| 252 | + gen = sdata._gen_elements() |
| 253 | + for _, name, obj in gen: |
| 254 | + if name != element_name: |
| 255 | + assert test_space not in get_transformation(obj, get_all=True) |
| 256 | + else: |
| 257 | + assert test_space in get_transformation(obj, get_all=True) |
0 commit comments