diff options
| author | hippo91 <guillaume.peillex@gmail.com> | 2019-04-06 13:26:29 +0200 |
|---|---|---|
| committer | hippo91 <guillaume.peillex@gmail.com> | 2019-04-06 13:26:29 +0200 |
| commit | be16e43e9d7759eab6cd3effb0b080b50c9ab97a (patch) | |
| tree | e4f2a097722f9bcb991f8b74fbca035c2bb18b40 | |
| parent | 86ffb90ab342a666cf73e84f900680a61aac2437 (diff) | |
| download | astroid-git-be16e43e9d7759eab6cd3effb0b080b50c9ab97a.tar.gz | |
Deleting test about __inv__ method which doesn't exists in ndarray
| -rw-r--r-- | astroid/tests/unittest_brain_numpy.py | 188 |
1 files changed, 1 insertions, 187 deletions
diff --git a/astroid/tests/unittest_brain_numpy.py b/astroid/tests/unittest_brain_numpy.py index 5e5f391d..0897dc10 100644 --- a/astroid/tests/unittest_brain_numpy.py +++ b/astroid/tests/unittest_brain_numpy.py @@ -45,192 +45,6 @@ def subTestMock(msg=None): @unittest.skipUnless(HAS_NUMPY, "This test requires the numpy library.") -class NumpyBrainCoreUmathTest(SubTestWrapper): - """ - Test of all members of numpy.core.umath module - """ - - no_arg_ufunc = ("geterrobj",) - - one_arg_ufunc_spec = ("seterrobj",) - - one_arg_ufunc = ( - "arccos", - "arccosh", - "arcsin", - "arcsinh", - "arctan", - "arctanh", - "cbrt", - "conj", - "conjugate", - "cosh", - "deg2rad", - "degrees", - "exp2", - "expm1", - "fabs", - "frexp", - "isfinite", - "isinf", - "log", - "log1p", - "log2", - "logical_not", - "modf", - "negative", - "rad2deg", - "radians", - "reciprocal", - "rint", - "sign", - "signbit", - "spacing", - "square", - "tan", - "tanh", - "trunc", - ) - - two_args_ufunc = ( - "bitwise_and", - "bitwise_or", - "bitwise_xor", - "copysign", - "divide", - "equal", - "float_power", - "floor_divide", - "fmax", - "fmin", - "fmod", - "greater", - "hypot", - "ldexp", - "left_shift", - "less", - "logaddexp", - "logaddexp2", - "logical_and", - "logical_or", - "logical_xor", - "maximum", - "minimum", - "nextafter", - "not_equal", - "power", - "remainder", - "right_shift", - "subtract", - "true_divide", - ) - - all_ufunc = no_arg_ufunc + one_arg_ufunc_spec + one_arg_ufunc + two_args_ufunc - - constants = ("e", "euler_gamma") - - def _inferred_numpy_attribute(self, func_name): - node = builder.extract_node( - """ - import numpy.core.umath as tested_module - func = tested_module.{:s} - func""".format( - func_name - ) - ) - return next(node.infer()) - - def test_numpy_core_umath_constants(self): - """ - Test that constants have Const type. - """ - for const in self.constants: - with self.subTest(const=const): - inferred = self._inferred_numpy_attribute(const) - self.assertIsInstance(inferred, nodes.Const) - - def test_numpy_core_umath_constants_values(self): - """ - Test the values of the constants. - """ - exact_values = {"e": 2.718281828459045, "euler_gamma": 0.5772156649015329} - for const in self.constants: - with self.subTest(const=const): - inferred = self._inferred_numpy_attribute(const) - self.assertEqual(inferred.value, exact_values[const]) - - def test_numpy_core_umath_functions(self): - """ - Test that functions have FunctionDef type. - """ - for func in self.all_ufunc: - with self.subTest(func=func): - inferred = self._inferred_numpy_attribute(func) - self.assertIsInstance(inferred, nodes.FunctionDef) - - def test_numpy_core_umath_functions_no_arg(self): - """ - Test that functions with no arguments have really no arguments. - """ - for func in self.no_arg_ufunc: - with self.subTest(func=func): - inferred = self._inferred_numpy_attribute(func) - self.assertFalse(inferred.argnames()) - - def test_numpy_core_umath_functions_one_arg_spec(self): - """ - Test the arguments names of functions. - """ - exact_arg_names = ["errobj"] - for func in self.one_arg_ufunc_spec: - with self.subTest(func=func): - inferred = self._inferred_numpy_attribute(func) - self.assertEqual(inferred.argnames(), exact_arg_names) - - def test_numpy_core_umath_functions_one_arg(self): - """ - Test the arguments names of functions. - """ - exact_arg_names = ["x", "out", "where", "casting", "order", "dtype", "subok"] - for func in self.one_arg_ufunc: - with self.subTest(func=func): - inferred = self._inferred_numpy_attribute(func) - self.assertEqual(inferred.argnames(), exact_arg_names) - - def test_numpy_core_umath_functions_two_args(self): - """ - Test the arguments names of functions. - """ - exact_arg_names = [ - "x1", - "x2", - "out", - "where", - "casting", - "order", - "dtype", - "subok", - ] - for func in self.two_args_ufunc: - with self.subTest(func=func): - inferred = self._inferred_numpy_attribute(func) - self.assertEqual(inferred.argnames(), exact_arg_names) - - def test_numpy_core_umath_functions_kwargs_default_values(self): - """ - Test the default values for keyword arguments. - """ - exact_kwargs_default_values = [None, True, "same_kind", "K", None, True] - for func in self.one_arg_ufunc + self.two_args_ufunc: - with self.subTest(func=func): - inferred = self._inferred_numpy_attribute(func) - default_args_values = [ - default.value for default in inferred.args.defaults - ] - self.assertEqual(default_args_values, exact_kwargs_default_values) - - -@unittest.skipUnless(HAS_NUMPY, "This test requires the numpy library.") class NumpyBrainRandomMtrandTest(SubTestWrapper): """ Test of all the functions of numpy.random.mtrand module. @@ -611,7 +425,7 @@ class NumpyBrainCoreNumericTypesTest(SubTestWrapper): """ Test that array types have unary operators """ - unary_ops = ("__neg__", "__inv__", "__invert__") + unary_ops = ("__neg__", "__invert__") for type_ in ("ndarray",): with self.subTest(typ=type_): |
