def test_removed_function_from_instance(): class A: def func(self): return "a" a = A() a.func = removed_function("foo") with pytest.warns(DeprecationWarning): a.func()
"""Called by Python interpreter before using any method or property on the object. So this will short-circuit essentially any access to this object. Args: name: """ raise self.exc def _module_import_error(py_module, feature, extras): """Return error message for module import errors, provide installation details. Args: py_module (str): Module that failed to be imported feature (str): Affected SageMaker feature extras (str): Name of the `extras_require` to install the relevant dependencies Returns: str: Error message with installation instructions. """ error_msg = ( "Failed to import {}. {} features will be impaired or broken. " "Please run \"pip install 'sagemaker[{}]'\" " "to install all required dependencies." ) return error_msg.format(py_module, feature, extras) get_ecr_image_uri_prefix = deprecations.removed_function("get_ecr_image_uri_prefix")
class A: func = removed_function("foo")
def test_removed_function(): removed = removed_function("foo") with pytest.warns(DeprecationWarning): removed()