Skip to content

Commit

Permalink
Merge pull request numpy#2745 from certik/fix_warnings
Browse files Browse the repository at this point in the history
TST: Catch possible warnings
  • Loading branch information
certik committed Dec 4, 2012
2 parents b531ed2 + 2d841a8 commit 7b75899
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions numpy/ma/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2770,11 +2770,23 @@ def test_varstd_specialcases(self):
self.assertTrue(method(0) is masked)
self.assertTrue(method(-1) is masked)
# Using a masked array as explicit output
_ = method(out=mout)
warn_ctx = WarningManager()
warn_ctx.__enter__()
try:
warnings.simplefilter('ignore')
_ = method(out=mout)
finally:
warn_ctx.__exit__()
self.assertTrue(mout is not masked)
assert_equal(mout.mask, True)
# Using a ndarray as explicit output
_ = method(out=nout)
warn_ctx = WarningManager()
warn_ctx.__enter__()
try:
warnings.simplefilter('ignore')
_ = method(out=nout)
finally:
warn_ctx.__exit__()
self.assertTrue(np.isnan(nout))
#
x = array(arange(10), mask=True)
Expand Down

0 comments on commit 7b75899

Please sign in to comment.