def test_scope_setter_immutable():
        """
        When setting the `scopes` property for an op, the value should be deep copied.
        """

        @mb.program(input_specs=[mb.TensorSpec(shape=(2, 3))])
        def prog(x):
            with mb.scope(
                ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_NAME, data=["module_1"]),
            ):
                x = mb.add(x=x, y=5.4)

            with mb.scope(
                ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_NAME, data=["module_2"]),
            ):
                y = mb.add(x=x, y=5.4)

            x.scopes = y.scopes
            y.scopes[ScopeSource.TORCHSCRIPT_MODULE_NAME][0] = "invalid"
            assert x.scopes[ScopeSource.TORCHSCRIPT_MODULE_NAME][0] == "module_2"

            return x

        When setting the `scopes` property for an op, the value should be deep copied.
        
coremltools/converters/mil/mil/tests/test_programs.py