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)
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'])
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'])
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)
def test_non_ufunc(self): msg = 'not a ufunc' with self.assertRaisesRegexp(TypeError, msg): _ufunc_wrapper(lambda x: x)
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)
def test_non_ufunc(self): msg = 'not a ufunc' with six.assertRaisesRegex(self, TypeError, msg): _ufunc_wrapper(lambda x: x)