summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2012-11-17 20:52:08 +0200
committerPauli Virtanen <pav@iki.fi>2012-11-17 20:52:08 +0200
commit7b3e6fa5c8eb92eeab20bfbb6f4298d97396e103 (patch)
treebd2f8b4176fbb3ea22d958a88686d1c17bbeb6e8 /numpy/f2py/tests
parent4b500dd8dbeb6e1c02a32cbc7ab27b5f6db3331f (diff)
downloadnumpy-7b3e6fa5c8eb92eeab20bfbb6f4298d97396e103.tar.gz
TST: f2py: rewrite strings to be easier to read
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r--numpy/f2py/tests/test_callback.py52
-rw-r--r--numpy/f2py/tests/test_mixed.py13
2 files changed, 39 insertions, 26 deletions
diff --git a/numpy/f2py/tests/test_callback.py b/numpy/f2py/tests/test_callback.py
index 4ee071690..5e0cda242 100644
--- a/numpy/f2py/tests/test_callback.py
+++ b/numpy/f2py/tests/test_callback.py
@@ -2,6 +2,7 @@ from numpy.testing import *
from numpy import array
import math
import util
+import textwrap
class TestF77Callback(util.F2PyTest):
code = """
@@ -40,30 +41,33 @@ cf2py intent(out) a
@dec.slow
def test_docstring(self):
- assert_equal(self.module.t.__doc__,
- "a = t(fun,[fun_extra_args])\n"
- "\n"
- "Wrapper for ``t``.\n"
- "\n"
- "Parameters\n"
- "----------\n"
- "fun : call-back function\n"
- "\n"
- "Other Parameters\n"
- "----------------\n"
- "fun_extra_args : input tuple, optional\n"
- " Default: ()\n"
- "\n"
- "Returns\n-------\n"
- "a : int\n"
- "\n"
- "Notes\n"
- "-----\n"
- "Call-back functions::\n"
- "\n"
- " def fun(): return a\n"
- " Return objects:\n"
- " a : int\n")
+ expected = """
+ a = t(fun,[fun_extra_args])
+
+ Wrapper for ``t``.
+
+ Parameters
+ ----------
+ fun : call-back function
+
+ Other Parameters
+ ----------------
+ fun_extra_args : input tuple, optional
+ Default: ()
+
+ Returns
+ -------
+ a : int
+
+ Notes
+ -----
+ Call-back functions::
+
+ def fun(): return a
+ Return objects:
+ a : int
+ """
+ assert_equal(self.module.t.__doc__, textwrap.dedent(expected).lstrip())
def check_function(self, name):
t = getattr(self.module, name)
diff --git a/numpy/f2py/tests/test_mixed.py b/numpy/f2py/tests/test_mixed.py
index 0263c528c..f786f38dd 100644
--- a/numpy/f2py/tests/test_mixed.py
+++ b/numpy/f2py/tests/test_mixed.py
@@ -5,6 +5,7 @@ from numpy.testing import *
from numpy import array
import util
+import textwrap
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
@@ -22,8 +23,16 @@ class TestMixed(util.F2PyTest):
@dec.slow
def test_docstring(self):
- assert_equal(self.module.bar11.__doc__,
- "a = bar11()\n\nWrapper for ``bar11``.\n\nReturns\n-------\na : int\n")
+ expected = """
+ a = bar11()
+
+ Wrapper for ``bar11``.
+
+ Returns
+ -------
+ a : int
+ """
+ assert_equal(self.module.bar11.__doc__, textwrap.dedent(expected).lstrip())
if __name__ == "__main__":
import nose