How to use the nptyping.NDArray.type_of function in nptyping

To help you get started, we’ve selected a few nptyping examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ramonhagenaars / nptyping / tests / test_types / test_ndarray.py View on Github external
def test_type_of(self):
        arr1 = np.array([1, 2, 3])
        arr2 = np.array([1, 2, '3'])
        arr3 = np.array([1, 2, 3.0])
        arr4 = np.array([1, 2, {}])

        t1 = NDArray.type_of(arr1)
        t2 = NDArray.type_of(arr2)
        t3 = NDArray.type_of(arr3)
        t4 = NDArray.type_of(arr4)

        self.assertIsInstance(arr1, t1)
        self.assertIsInstance(arr2, t2)
        self.assertIsInstance(arr3, t3)
        self.assertIsInstance(arr4, t4)
github ramonhagenaars / nptyping / tests / test_types / test_ndarray.py View on Github external
def test_type_of(self):
        arr1 = np.array([1, 2, 3])
        arr2 = np.array([1, 2, '3'])
        arr3 = np.array([1, 2, 3.0])
        arr4 = np.array([1, 2, {}])

        t1 = NDArray.type_of(arr1)
        t2 = NDArray.type_of(arr2)
        t3 = NDArray.type_of(arr3)
        t4 = NDArray.type_of(arr4)

        self.assertIsInstance(arr1, t1)
        self.assertIsInstance(arr2, t2)
        self.assertIsInstance(arr3, t3)
        self.assertIsInstance(arr4, t4)
github ramonhagenaars / nptyping / tests / test_types / test_ndarray.py View on Github external
def test_type_of(self):
        arr1 = np.array([1, 2, 3])
        arr2 = np.array([1, 2, '3'])
        arr3 = np.array([1, 2, 3.0])
        arr4 = np.array([1, 2, {}])

        t1 = NDArray.type_of(arr1)
        t2 = NDArray.type_of(arr2)
        t3 = NDArray.type_of(arr3)
        t4 = NDArray.type_of(arr4)

        self.assertIsInstance(arr1, t1)
        self.assertIsInstance(arr2, t2)
        self.assertIsInstance(arr3, t3)
        self.assertIsInstance(arr4, t4)
github ramonhagenaars / nptyping / tests / test_types / test_ndarray.py View on Github external
def test_type_of(self):
        arr1 = np.array([1, 2, 3])
        arr2 = np.array([1, 2, '3'])
        arr3 = np.array([1, 2, 3.0])
        arr4 = np.array([1, 2, {}])

        t1 = NDArray.type_of(arr1)
        t2 = NDArray.type_of(arr2)
        t3 = NDArray.type_of(arr3)
        t4 = NDArray.type_of(arr4)

        self.assertIsInstance(arr1, t1)
        self.assertIsInstance(arr2, t2)
        self.assertIsInstance(arr3, t3)
        self.assertIsInstance(arr4, t4)