예제 #1
0
 def test_method_docstring(self):
     import numpy as np
     doc = int.bit_length.__doc__
     try:
         np.set_docstring(np.ndarray.shape, 'foo')
         assert np.ndarray.shape.__doc__ == 'foo'
     finally:
         np.set_docstring(np.ndarray.shape, doc)
예제 #2
0
 def test_property_docstring(self):
     import numpy as np
     doc = np.flatiter.base.__doc__
     try:
         np.set_docstring(np.flatiter.base, 'foo')
         assert np.flatiter.base.__doc__ == 'foo'
     finally:
         np.set_docstring(np.flatiter.base, doc)
예제 #3
0
 def test_method_docstring(self):
     import numpy as np
     doc = int.bit_length.__doc__
     try:
         np.set_docstring(int.bit_length, 'foo')
         assert int.bit_length.__doc__ == 'foo'
     finally:
         np.set_docstring(int.bit_length, doc)
예제 #4
0
 def test_property_docstring(self):
     import numpy as np
     doc = np.flatiter.base.__doc__
     try:
         np.set_docstring(np.flatiter.base, 'foo')
         assert np.flatiter.base.__doc__ == 'foo'
     finally:
         np.set_docstring(np.flatiter.base, doc)
예제 #5
0
 def test_method_docstring(self):
     import numpy as np
     doc = int.bit_length.__doc__
     try:
         np.set_docstring(int.bit_length, 'foo')
         assert int.bit_length.__doc__ == 'foo'
     finally:
         np.set_docstring(int.bit_length, doc)
예제 #6
0
    def test_type_docstring(self):
        import numpy as np
        import types
        obj = types.ModuleType
        doc = obj.__doc__
        try:
            np.set_docstring(obj, 'foo')
            assert obj.__doc__ == 'foo'
        finally:
            np.set_docstring(obj, doc)

        raises(RuntimeError, np.add_docstring, obj, 'foo')
예제 #7
0
    def test_type_docstring(self):
        import numpy as np
        import types
        obj = types.ModuleType
        doc = obj.__doc__
        try:
            np.set_docstring(obj, 'foo')
            assert obj.__doc__ == 'foo'
        finally:
            np.set_docstring(obj, doc)

        raises(RuntimeError, np.add_docstring, obj, 'foo')
예제 #8
0
파일: test_ufuncs.py 프로젝트: Qointum/pypy
    def test_add_doc(self):
        import sys

        if "__pypy__" not in sys.builtin_module_names:
            skip("")
        try:
            from numpy import set_docstring
        except ImportError:
            from _numpypy.multiarray import set_docstring
        import numpy as np

        assert np.add.__doc__ is None
        add_doc = np.add.__doc__
        ufunc_doc = np.ufunc.__doc__
        try:
            np.add.__doc__ = "np.add"
            assert np.add.__doc__ == "np.add"
            # Test for interferences between ufunc objects and their class
            set_docstring(np.ufunc, "np.ufunc")
            assert np.ufunc.__doc__ == "np.ufunc"
            assert np.add.__doc__ == "np.add"
        finally:
            set_docstring(np.ufunc, ufunc_doc)
            np.add.__doc__ = add_doc