Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_bits(self):
self.assertEqual(8, Int8.bits())
self.assertEqual(16, Int16.bits())
self.assertEqual(32, Int32.bits())
self.assertEqual(64, Int64.bits())
self.assertEqual(16, Float16.bits())
self.assertEqual(32, Float32.bits())
self.assertEqual(64, Float64.bits())
self.assertTrue(Int16 == Int16)
self.assertTrue(Int32 == Int32)
self.assertTrue(Int64 == Int64)
self.assertTrue(UInt8 == UInt8)
self.assertTrue(UInt16 == UInt16)
self.assertTrue(UInt32 == UInt32)
self.assertTrue(UInt64 == UInt64)
self.assertTrue(Float16 == Float16)
self.assertTrue(Float32 == Float32)
self.assertTrue(Float64 == Float64)
self.assertTrue(Int8 != Int16)
self.assertTrue(Int32 != Float32)
self.assertTrue(Int32 != UInt32)
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))
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_))