def get_transform(self, transform): transform = unwrap(transform) if not transform: return # For OMERO 5.1.x and OMERO 5.2.x the unwrapped transform is a string. # To facilitate the encoding we construct an internal AffineTransform # object and use convert_svg_transform() to map the SVG string # representation into the fields defined by the schema. from omero_marshal.legacy.affinetransform import AffineTransformI t = AffineTransformI() try: t.convert_svg_transform(transform) except ValueError: # Means the string is an invalid or unsupported SVG transform return return t
def test_convert_transform(self, transform_s, transform_o): t = AffineTransformI() t.convert_svg_transform(transform_s) assert str(t) == transform_o
def test_invalid_transform(self, transform): t = AffineTransformI() with pytest.raises(ValueError): t.convert_svg_transform(transform)