From 2f1174dee44e901b7d028beb86f4a8ea324bd74f Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Thu, 11 Jul 2013 16:49:04 -0600 Subject: MAINT: Use np.errstate context manager. Now that Python < 2.6 is no longer supported we can use the errstate context manager in places where constructs like ``` old = seterr(invalid='ignore') try: blah finally: seterr(**old) ``` were used. --- numpy/ma/tests/test_subclassing.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'numpy/ma/tests/test_subclassing.py') diff --git a/numpy/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py index 54b202684..7014246d4 100644 --- a/numpy/ma/tests/test_subclassing.py +++ b/numpy/ma/tests/test_subclassing.py @@ -96,12 +96,9 @@ class TestSubclassing(TestCase): def test_masked_unary_operations(self): "Tests masked_unary_operation" (x, mx) = self.data - olderr = np.seterr(divide='ignore') - try: + with np.errstate(divide='ignore'): self.assertTrue(isinstance(log(mx), mmatrix)) assert_equal(log(x), np.log(x)) - finally: - np.seterr(**olderr) def test_masked_binary_operations(self): "Tests masked_binary_operation" -- cgit v1.2.1