'Test special.typeof() with ndarray values.'

@tag('important')
def test_array_values(self):

    def check(arr, ndim, layout, mutable, aligned):
        ty = typeof(arr)
        self.assertIsInstance(ty, types.Array)
        self.assertEqual(ty.ndim, ndim)
        self.assertEqual(ty.layout, layout)
        self.assertEqual(ty.mutable, mutable)
        self.assertEqual(ty.aligned, aligned)
    a1 = np.arange(10)
    check(a1, 1, 'C', True, True)
    a2 = np.arange(10).reshape(2, 5)
    check(a2, 2, 'C', True, True)
    check(a2.T, 2, 'F', True, True)
    a3 = np.arange(60)[::2].reshape((2, 5, 3))
    check(a3, 3, 'A', True, True)
    a4 = np.arange(1).reshape(())
    check(a4, 0, 'C', True, True)
    a4.flags.writeable = False
    check(a4, 0, 'C', False, True)
    a5 = a1.astype(a1.dtype.newbyteorder())
    with self.assertRaises(ValueError) as raises:
        typeof(a5)
    self.assertIn(('Unsupported    array    dtype:    %s' % (a5.dtype,)), str(raises.exception))
