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