コード例 #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)