Exemplo n.º 1
0
 def test_int16_dtype_is_converted_to_mode_1(self):
     mode = utils.mode_from_dtype(np.dtype(np.int16))
     assert mode == 1
Exemplo n.º 2
0
 def test_int64_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype(np.int64))
Exemplo n.º 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))
Exemplo n.º 4
0
 def test_int8_dtype_is_converted_to_mode_0(self):
     mode = utils.mode_from_dtype(np.dtype(np.int8))
     assert mode == 0
Exemplo n.º 5
0
 def test_structured_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype([('f1', np.int32)]))
Exemplo n.º 6
0
 def test_float32_dtype_is_converted_to_mode_2(self):
     mode = utils.mode_from_dtype(np.dtype(np.float32))
     assert mode == 2
Exemplo n.º 7
0
 def test_object_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype(object))
Exemplo n.º 8
0
 def test_unicode_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype('U1'))
Exemplo n.º 9
0
 def test_complex128_dtype_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.mode_from_dtype(np.dtype(np.complex128))
Exemplo n.º 10
0
 def test_complex64_dtype_is_converted_to_mode_4(self):
     mode = utils.mode_from_dtype(np.dtype(np.complex64))
     assert mode == 4
Exemplo n.º 11
0
 def test_float16_dtype_is_converted_to_mode_12(self):
     mode = utils.mode_from_dtype(np.dtype(np.float16))
     assert mode == 12