How to use nptyping - 10 common examples

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_functions / test_get_type.py View on Github external
def test_get_type_numpy_dtype(self):
        self.assertEqual(Int8, get_type(np.int8(42)))
        self.assertEqual(Int16, get_type(np.int16(42)))
        self.assertEqual(Int32, get_type(np.int32(42)))
        self.assertEqual(Int64, get_type(np.int64(42)))

        self.assertEqual(UInt8, get_type(np.uint8(42)))
        self.assertEqual(UInt16, get_type(np.uint16(42)))
        self.assertEqual(UInt32, get_type(np.uint32(42)))
        self.assertEqual(UInt64, get_type(np.uint64(42)))

        self.assertEqual(Float16, get_type(np.float16(42.0)))
        self.assertEqual(Float32, get_type(np.float32(42.0)))
        self.assertEqual(Float64, get_type(np.float64(42.0)))

        self.assertEqual(Unicode, get_type(np.unicode))
        self.assertEqual(Unicode[40], get_type(np.dtype(('U', 40))))

        self.assertEqual(Bool, get_type(np.bool_(True)))
        self.assertEqual(Bool, get_type(np.bool_(False)))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_numpy_dtype(self):
        self.assertEqual(Int8, get_type(np.int8(42)))
        self.assertEqual(Int16, get_type(np.int16(42)))
        self.assertEqual(Int32, get_type(np.int32(42)))
        self.assertEqual(Int64, get_type(np.int64(42)))

        self.assertEqual(UInt8, get_type(np.uint8(42)))
        self.assertEqual(UInt16, get_type(np.uint16(42)))
        self.assertEqual(UInt32, get_type(np.uint32(42)))
        self.assertEqual(UInt64, get_type(np.uint64(42)))

        self.assertEqual(Float16, get_type(np.float16(42.0)))
        self.assertEqual(Float32, get_type(np.float32(42.0)))
        self.assertEqual(Float64, get_type(np.float64(42.0)))

        self.assertEqual(Unicode, get_type(np.unicode))
        self.assertEqual(Unicode[40], get_type(np.dtype(('U', 40))))

        self.assertEqual(Bool, get_type(np.bool_(True)))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_numpy_dtype(self):
        self.assertEqual(Int8, get_type(np.int8(42)))
        self.assertEqual(Int16, get_type(np.int16(42)))
        self.assertEqual(Int32, get_type(np.int32(42)))
        self.assertEqual(Int64, get_type(np.int64(42)))

        self.assertEqual(UInt8, get_type(np.uint8(42)))
        self.assertEqual(UInt16, get_type(np.uint16(42)))
        self.assertEqual(UInt32, get_type(np.uint32(42)))
        self.assertEqual(UInt64, get_type(np.uint64(42)))

        self.assertEqual(Float16, get_type(np.float16(42.0)))
        self.assertEqual(Float32, get_type(np.float32(42.0)))
        self.assertEqual(Float64, get_type(np.float64(42.0)))

        self.assertEqual(Unicode, get_type(np.unicode))
        self.assertEqual(Unicode[40], get_type(np.dtype(('U', 40))))

        self.assertEqual(Bool, get_type(np.bool_(True)))
        self.assertEqual(Bool, get_type(np.bool_(False)))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_numpy_type(self):
        self.assertEqual(Int8, get_type(np.int8))
        self.assertEqual(Int16, get_type(np.int16))
        self.assertEqual(Int32, get_type(np.int32))
        self.assertEqual(Int64, get_type(np.int64))

        self.assertEqual(UInt8, get_type(np.uint8))
        self.assertEqual(UInt16, get_type(np.uint16))
        self.assertEqual(UInt32, get_type(np.uint32))
        self.assertEqual(UInt64, get_type(np.uint64))

        self.assertEqual(Float16, get_type(np.float16))
        self.assertEqual(Float32, get_type(np.float32))
        self.assertEqual(Float64, get_type(np.float64))

        self.assertEqual(Bool, get_type(np.bool_))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_numpy_type(self):
        self.assertEqual(Int8, get_type(np.int8))
        self.assertEqual(Int16, get_type(np.int16))
        self.assertEqual(Int32, get_type(np.int32))
        self.assertEqual(Int64, get_type(np.int64))

        self.assertEqual(UInt8, get_type(np.uint8))
        self.assertEqual(UInt16, get_type(np.uint16))
        self.assertEqual(UInt32, get_type(np.uint32))
        self.assertEqual(UInt64, get_type(np.uint64))

        self.assertEqual(Float16, get_type(np.float16))
        self.assertEqual(Float32, get_type(np.float32))
        self.assertEqual(Float64, get_type(np.float64))

        self.assertEqual(Bool, get_type(np.bool_))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_numpy_dtype(self):
        self.assertEqual(Int8, get_type(np.int8(42)))
        self.assertEqual(Int16, get_type(np.int16(42)))
        self.assertEqual(Int32, get_type(np.int32(42)))
        self.assertEqual(Int64, get_type(np.int64(42)))

        self.assertEqual(UInt8, get_type(np.uint8(42)))
        self.assertEqual(UInt16, get_type(np.uint16(42)))
        self.assertEqual(UInt32, get_type(np.uint32(42)))
        self.assertEqual(UInt64, get_type(np.uint64(42)))

        self.assertEqual(Float16, get_type(np.float16(42.0)))
        self.assertEqual(Float32, get_type(np.float32(42.0)))
        self.assertEqual(Float64, get_type(np.float64(42.0)))

        self.assertEqual(Unicode, get_type(np.unicode))
        self.assertEqual(Unicode[40], get_type(np.dtype(('U', 40))))

        self.assertEqual(Bool, get_type(np.bool_(True)))
        self.assertEqual(Bool, get_type(np.bool_(False)))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_bool(self):
        self.assertEqual(Bool, get_type(True))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_nptype(self):
        self.assertEqual(Int32, get_type(Int32))
        self.assertEqual(Float64, get_type(Float64))
        self.assertEqual(Unicode[100], get_type(Unicode[100]))
        self.assertEqual(Bool, get_type(Bool))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_numpy_dtype(self):
        self.assertEqual(Int8, get_type(np.int8(42)))
        self.assertEqual(Int16, get_type(np.int16(42)))
        self.assertEqual(Int32, get_type(np.int32(42)))
        self.assertEqual(Int64, get_type(np.int64(42)))

        self.assertEqual(UInt8, get_type(np.uint8(42)))
        self.assertEqual(UInt16, get_type(np.uint16(42)))
        self.assertEqual(UInt32, get_type(np.uint32(42)))
        self.assertEqual(UInt64, get_type(np.uint64(42)))

        self.assertEqual(Float16, get_type(np.float16(42.0)))
        self.assertEqual(Float32, get_type(np.float32(42.0)))
        self.assertEqual(Float64, get_type(np.float64(42.0)))

        self.assertEqual(Unicode, get_type(np.unicode))
        self.assertEqual(Unicode[40], get_type(np.dtype(('U', 40))))

        self.assertEqual(Bool, get_type(np.bool_(True)))
        self.assertEqual(Bool, get_type(np.bool_(False)))
github ramonhagenaars / nptyping / tests / test_functions / test_get_type.py View on Github external
def test_get_type_str(self):
        self.assertEqual(Unicode[4], get_type('Test'))