From 66174b8aa5644b11054b72761e89e22fd8a18eae Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Tue, 19 Nov 2013 00:25:32 +0100 Subject: ENH: improve add_newdocs performance replace slow exec with a direct __import__. improves `import numpy` speed by about 10%. --- numpy/lib/tests/test_function_base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index f91ab8aa1..6829e06ae 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1808,6 +1808,7 @@ class TestMedian(TestCase): a = MySubClass([1,2,3]) assert_equal(np.median(a), -7) + class TestAdd_newdoc_ufunc(TestCase): def test_ufunc_arg(self): @@ -1818,5 +1819,14 @@ class TestAdd_newdoc_ufunc(TestCase): assert_raises(TypeError, add_newdoc_ufunc, np.add, 3) +class TestAdd_newdoc(TestCase): + def test_add_doc(self): + # test np.add_newdoc + tgt = "Current flat index into the array." + self.assertEqual(np.core.flatiter.index.__doc__[:len(tgt)], tgt) + self.assertTrue(len(np.core.ufunc.identity.__doc__) > 300) + self.assertTrue(len(np.lib.index_tricks.mgrid.__doc__) > 300) + + if __name__ == "__main__": run_module_suite() -- cgit v1.2.1