コード例 #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
ファイル: test_utils.py プロジェクト: ccpem/mrcfile
 def test_float16_dtype_is_converted_to_mode_12(self):
     mode = utils.mode_from_dtype(np.dtype(np.float16))
     assert mode == 12