Пример #1
0
    def test_nin1_docstring(self):
        wrapped_fn = _ufunc_wrapper(np.negative)
        doc = inspect.getdoc(wrapped_fn)

        expected = ('Return the elementwise evaluation of '
                    'np.negative(a) as another Array.')
        self.assertEqual(doc, expected)
Пример #2
0
    def test_nin1_docstring(self):
        wrapped_fn = _ufunc_wrapper(np.negative)
        doc = inspect.getdoc(wrapped_fn)

        expected = ('Return the elementwise evaluation of '
                    'np.negative(a) as another Array.')
        self.assertEqual(doc, expected)
Пример #3
0
 def test_updates_all_override_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp, 'foo')
     self.assertEqual(tmp_all, ['foo'])
Пример #4
0
 def test_updates_all_default_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp)
     self.assertEqual(tmp_all, ['exp'])
Пример #5
0
 def test_nout2_ufunc(self):
     msg = "Unsupported ufunc 'modf' with 1 input arrays & 2 output arrays."
     with self.assertRaisesRegexp(ValueError, msg):
         _ufunc_wrapper(np.modf)
Пример #6
0
 def test_non_ufunc(self):
     msg = 'not a ufunc'
     with self.assertRaisesRegexp(TypeError, msg):
         _ufunc_wrapper(lambda x: x)
Пример #7
0
 def test_updates_all_override_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp, 'foo')
     self.assertEqual(tmp_all, ['foo'])
Пример #8
0
 def test_updates_all_default_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp)
     self.assertEqual(tmp_all, ['exp'])
Пример #9
0
 def test_nout2_ufunc(self):
     msg = "Unsupported ufunc 'modf' with 1 input arrays & 2 output arrays."
     with six.assertRaisesRegex(self, ValueError, msg):
         _ufunc_wrapper(np.modf)
Пример #10
0
 def test_non_ufunc(self):
     msg = 'not a ufunc'
     with six.assertRaisesRegex(self, TypeError, msg):
         _ufunc_wrapper(lambda x: x)