Пример #1
0
 def test_int16_dtype_is_converted_to_mode_1(self):
     mode = utils.mode_from_dtype(np.dtype(np.int16))
     assert mode == 1
Пример #2
0
 def test_int64_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype(np.int64))
Пример #3
0
 def test_float128_dtype_raises_exception(self):
     # float128 only exists on some platforms
     if hasattr(np, 'float128'):
         with self.assertRaises(ValueError):
             utils.mode_from_dtype(np.dtype(np.float128))
Пример #4
0
 def test_int8_dtype_is_converted_to_mode_0(self):
     mode = utils.mode_from_dtype(np.dtype(np.int8))
     assert mode == 0
Пример #5
0
 def test_structured_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype([('f1', np.int32)]))
Пример #6
0
 def test_float32_dtype_is_converted_to_mode_2(self):
     mode = utils.mode_from_dtype(np.dtype(np.float32))
     assert mode == 2
Пример #7
0
 def test_object_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype(object))
Пример #8
0
 def test_unicode_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype('U1'))
Пример #9
0
 def test_complex128_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype(np.complex128))
Пример #10
0
 def test_complex64_dtype_is_converted_to_mode_4(self):
     mode = utils.mode_from_dtype(np.dtype(np.complex64))
     assert mode == 4
Пример #11
0
 def test_float16_dtype_is_converted_to_mode_12(self):
     mode = utils.mode_from_dtype(np.dtype(np.float16))
     assert mode == 12