Rename contextlib.ignored() to contextlib.ignore().
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index 868fa6c..41ff9cc 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -5,7 +5,7 @@
from functools import wraps
__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack",
- "ignored", "redirect_stdout"]
+ "ignore", "redirect_stdout"]
class ContextDecorator(object):
@@ -179,10 +179,10 @@
sys.stdout = self.old_target
@contextmanager
-def ignored(*exceptions):
+def ignore(*exceptions):
"""Context manager to ignore specified exceptions
- with ignored(OSError):
+ with ignore(OSError):
os.remove(somefile)
"""
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index d8a0530..48f8fa9 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -632,26 +632,26 @@
stack.push(cm)
self.assertIs(stack._exit_callbacks[-1], cm)
-class TestIgnored(unittest.TestCase):
+class TestIgnore(unittest.TestCase):
def test_no_exception(self):
- with ignored(ValueError):
+ with ignore(ValueError):
self.assertEqual(pow(2, 5), 32)
def test_exact_exception(self):
- with ignored(TypeError):
+ with ignore(TypeError):
len(5)
def test_multiple_exception_args(self):
- with ignored(ZeroDivisionError, TypeError):
+ with ignore(ZeroDivisionError, TypeError):
len(5)
def test_exception_hierarchy(self):
- with ignored(LookupError):
+ with ignore(LookupError):
'Hello'[50]
class TestRedirectStdout(unittest.TestCase):