def test_nested_before_op_context_manager(self):
        """
        Test that we can nest mb.set_before_op.
        """
        block = self.get_block()
        ops = list(block.operations)
        op1, op2 = ops[0], ops[1]
        with block:
            x = op1.x
            with mb.set_before_op(op1):
                mb.relu(x=x, name="a")
                mb.relu(x=x, name="b")
                with mb.set_before_op(op2):
                    mb.relu(x=x, name="c")
                mb.relu(x=x, name="d")
        self.verify_op_name(block, ["a", "b", "d", "x1", "c", "x2"])

        Test that we can nest mb.set_before_op.
        
coremltools/converters/mil/mil/tests/test_programs.py