summaryrefslogtreecommitdiff
path: root/numpy/core/tests/test_errstate.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2009-10-24 15:51:30 +0000
committerCharles Harris <charlesr.harris@gmail.com>2009-10-24 15:51:30 +0000
commitcdd23ab0073fb899db34d4d66f3e4b184a82c466 (patch)
tree70d0107461721135fec6f2feeab5745d94347979 /numpy/core/tests/test_errstate.py
parent21447667e0b426c6092eba1c94aaea62114b7b5d (diff)
downloadpython-numpy-cdd23ab0073fb899db34d4d66f3e4b184a82c466.tar.gz
python-numpy-cdd23ab0073fb899db34d4d66f3e4b184a82c466.tar.bz2
python-numpy-cdd23ab0073fb899db34d4d66f3e4b184a82c466.zip
Replace \r by \n.
Diffstat (limited to 'numpy/core/tests/test_errstate.py')
-rw-r--r--numpy/core/tests/test_errstate.py114
1 files changed, 57 insertions, 57 deletions
diff --git a/numpy/core/tests/test_errstate.py b/numpy/core/tests/test_errstate.py
index 6604d74db..7302f25e3 100644
--- a/numpy/core/tests/test_errstate.py
+++ b/numpy/core/tests/test_errstate.py
@@ -1,57 +1,57 @@
-# The following exec statement (or something like it) is needed to
-# prevent SyntaxError on Python < 2.5. Even though this is a test,
-# SyntaxErrors are not acceptable; on Debian systems, they block
-# byte-compilation during install and thus cause the package to fail
-# to install.
-
-import sys
-if sys.version_info[:2] >= (2, 5):
- exec """
-from __future__ import with_statement
-from numpy.core import *
-from numpy.random import rand, randint
-from numpy.testing import *
-
-class TestErrstate(TestCase):
- def test_invalid(self):
- with errstate(all='raise', under='ignore'):
- a = -arange(3)
- # This should work
- with errstate(invalid='ignore'):
- sqrt(a)
- # While this should fail!
- try:
- sqrt(a)
- except FloatingPointError:
- pass
- else:
- self.fail()
-
- def test_divide(self):
- with errstate(all='raise', under='ignore'):
- a = -arange(3)
- # This should work
- with errstate(divide='ignore'):
- a / 0
- # While this should fail!
- try:
- a / 0
- except FloatingPointError:
- pass
- else:
- self.fail()
-
- def test_errcall(self):
- def foo(*args):
- print args
- olderrcall = geterrcall()
- with errstate(call=foo):
- assert(geterrcall() is foo), 'call is not foo'
- with errstate(call=None):
- assert(geterrcall() is None), 'call is not None'
- assert(geterrcall() is olderrcall), 'call is not olderrcall'
-
-"""
-
-if __name__ == "__main__":
- run_module_suite()
+# The following exec statement (or something like it) is needed to
+# prevent SyntaxError on Python < 2.5. Even though this is a test,
+# SyntaxErrors are not acceptable; on Debian systems, they block
+# byte-compilation during install and thus cause the package to fail
+# to install.
+
+import sys
+if sys.version_info[:2] >= (2, 5):
+ exec """
+from __future__ import with_statement
+from numpy.core import *
+from numpy.random import rand, randint
+from numpy.testing import *
+
+class TestErrstate(TestCase):
+ def test_invalid(self):
+ with errstate(all='raise', under='ignore'):
+ a = -arange(3)
+ # This should work
+ with errstate(invalid='ignore'):
+ sqrt(a)
+ # While this should fail!
+ try:
+ sqrt(a)
+ except FloatingPointError:
+ pass
+ else:
+ self.fail()
+
+ def test_divide(self):
+ with errstate(all='raise', under='ignore'):
+ a = -arange(3)
+ # This should work
+ with errstate(divide='ignore'):
+ a / 0
+ # While this should fail!
+ try:
+ a / 0
+ except FloatingPointError:
+ pass
+ else:
+ self.fail()
+
+ def test_errcall(self):
+ def foo(*args):
+ print args
+ olderrcall = geterrcall()
+ with errstate(call=foo):
+ assert(geterrcall() is foo), 'call is not foo'
+ with errstate(call=None):
+ assert(geterrcall() is None), 'call is not None'
+ assert(geterrcall() is olderrcall), 'call is not olderrcall'
+
+"""
+
+if __name__ == "__main__":
+ run_module_suite()