8000 Change the default error state to 'warn' by rkern · Pull Request #65 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Change the default error state to 'warn' #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
BUG: Move the default errstate test over to the right place. Fix the …
…seterr test case to take the new defaults into account.
  • Loading branch information
rkern committed Apr 1, 2011
commit eeafa27b72790a58c6eda5a0a473beef20bd1f08
9 changes: 0 additions & 9 deletions numpy/core/tests/test_errstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
from numpy.testing import *

class TestErrstate(TestCase):
def test_default(self):
err = geterr()
self.assertEqual(err, dict(
divide='warn',
invalid='warn',
over='warn',
under='ignore',
))

def test_invalid(self):
with errstate(all='raise', under='ignore'):
a = -arange(3)
Expand Down
15 changes: 12 additions & 3 deletions numpy/core/tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,25 @@ def test_bitwise_xor(self):


class TestSeterr(TestCase):
def test_default(self):
err = geterr()
self.assertEqual(err, dict(
divide='warn',
invalid='warn',
over='warn',
under='ignore',
))

def test_set(self):
err = seterr()
try:
old = seterr(divide='warn')
old = seterr(divide='print')
self.assertTrue(err == old)
new = seterr()
self.assertTrue(new['divide'] == 'warn')
self.assertTrue(new['divide'] == 'print')
seterr(over='raise')
self.assertTrue(geterr()['over'] == 'raise')
self.assertTrue(new['divide'] == 'warn')
self.assertTrue(new['divide'] == 'print')
seterr(**old)
self.assertTrue(geterr() == old)
finally:
Expand Down
0