@@ -0,0 +1,2351 @@
+# -*- encoding=utf-8 -*-%0A# Copyright (c) 2017-2018 hippo91 %3Cguillaume.peillex@gmail.com%3E%0A%0A# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html%0A# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER%0Aimport unittest%0Aimport contextlib%0A%0Atry:%0A    import numpy  # pylint: disable=unused-import%0A%0A    HAS_NUMPY = True%0Aexcept ImportError:%0A    HAS_NUMPY = False%0A%0Afrom astroid import builder%0A%0A%0Aclass SubTestWrapper(unittest.TestCase):%0A    %22%22%22%0A    A class for supporting all unittest version wether or not subTest is available%0A    %22%22%22%0A%0A    def subTest(self, msg=None, **params):%0A        try:%0A            # For python versions above 3.5 this should be ok%0A            return super(SubTestWrapper, self).subTest(msg, **params)%0A        except AttributeError:%0A            # %C2%A0For python versions below 3.5%0A            return subTestMock(msg)%0A%0A%0A@contextlib.contextmanager%0Adef subTestMock(msg=None):%0A    %22%22%22%0A    A mock for subTest which do nothing%0A    %22%22%22%0A    yield msg%0A%0A%0A@unittest.skipUnless(HAS_NUMPY, %22This test requires the numpy library.%22)%0Aclass BrainNumpyCoreFromNumericTest(SubTestWrapper):%0A    %22%22%22%0A    Test the numpy core fromnumeric brain module%0A    %22%22%22%0A    numpy_functions = (%0A                       ('sum', %22%5B1, 2%5D%22),%0A                       )%0A%0A    def _inferred_numpy_func_call(self, func_name, *func_args):%0A        node = builder.extract_node(%0A            %22%22%22%0A        import numpy as np%0A        func = np.%7B:s%7D%0A        func(%7B:s%7D)%0A        %22%22%22.format(%0A                func_name, %22,%22.join(func_args)%0A            )%0A        )%0A        return node.infer()%0A%0A    def test_numpy_function_calls_inferred_as_ndarray(self):%0A        %22%22%22%0A        Test that calls to numpy functions are inferred as numpy.ndarray%0A        %22%22%22%0A        licit_array_types = ('.ndarray',)%0A        for func_ in self.numpy_functions:%0A            with self.subTest(typ=func_):%0A                inferred_values = list(self._inferred_numpy_func_call(*func_))%0A                self.assertTrue(len(inferred_values) == 1,%0A                                msg=%22Too much inferred value for %7B:s%7D%22.format(func_%5B0%5D))%0A                self.assertTrue(inferred_values%5B-1%5D.pytype() in licit_array_types,%0A                                msg=%22Illicit type for %7B:s%7D (%7B%7D)%22.format(func_%5B0%5D, inferred_values%5B-1%5D.pytype()))%0A%0A%0Aif __name__ == %22__main__%22:%0A    unittest.main()%0A

Add a unittest dedicated to the numpy_core_fromnumeric brain