diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-11-19 00:25:32 +0100 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-11-19 19:11:27 +0100 |
commit | 66174b8aa5644b11054b72761e89e22fd8a18eae (patch) | |
tree | 00f86588ac54d8233272c18a24c5f2b98d97214c /numpy/lib/tests/test_function_base.py | |
parent | 74e5c1291c96428ab5dac361edfa94bd2ec51d66 (diff) | |
download | numpy-66174b8aa5644b11054b72761e89e22fd8a18eae.tar.gz |
ENH: improve add_newdocs performance
replace slow exec with a direct __import__.
improves `import numpy` speed by about 10%.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 10 |
1 files changed, 10 insertions, 0 deletions
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() |