Exemplo n.º 1
0
 def test_mode_scalar_is_converted_without_error(self):
     dtype = utils.dtype_from_mode(np.float32(1))
     assert dtype == np.dtype(np.int16)
Exemplo n.º 2
0
 def test_mode_onedim_array_is_converted_without_error(self):
     dtype = utils.dtype_from_mode(np.array([1]))
     assert dtype == np.dtype(np.int16)
Exemplo n.º 3
0
 def test_mode_6_is_converted_to_uint16(self):
     dtype = utils.dtype_from_mode(6)
     assert dtype == np.dtype(np.uint16)
Exemplo n.º 4
0
 def test_undefined_modes_raise_exception(self):
     for mode in (x for x in range(-33, 34, 1) if x not in [0, 1, 2, 4, 6]):
         with self.assertRaises(ValueError):
             utils.dtype_from_mode(mode)
Exemplo n.º 5
0
 def test_mode_4_is_converted_to_complex64(self):
     dtype = utils.dtype_from_mode(4)
     assert dtype == np.dtype(np.complex64)
Exemplo n.º 6
0
 def test_mode_3_raises_exception(self):
     with self.assertRaises(ValueError):
         utils.dtype_from_mode(3)
Exemplo n.º 7
0
 def test_mode_2_is_converted_to_float32(self):
     dtype = utils.dtype_from_mode(2)
     assert dtype == np.dtype(np.float32)
Exemplo n.º 8
0
 def test_mode_1_is_converted_to_int16(self):
     dtype = utils.dtype_from_mode(1)
     assert dtype == np.dtype(np.int16)
Exemplo n.º 9
0
 def test_mode_0_is_converted_to_int8(self):
     dtype = utils.dtype_from_mode(0)
     assert dtype == np.dtype(np.int8)