def test_complex_dtype_nanprod(self, ndim, keepdims):
        """This test checks if nanprod works as expected for complex
        datatypes. The parametrized datatype is that of real/complex
        component, so float32 would correspond to complex64.
        """
        shape = (3,) * ndim
        size = prod(shape)

        dtype = np.float32

        r = np.random.random(shape).astype(dtype)
        c = np.random.random(shape).astype(dtype)

        # get index of nan
        index_nan = np.random.randint(low=0, high=size)
        index_nan = np.unravel_index(index_nan, shape)

        # set just the real component to nan
        r[index_nan] = np.nan

        # set an element to nan
        in_np = r + 1j * c

        in_num = num.array(in_np)

        out_num = num.nanprod(in_num, keepdims=keepdims)
        out_np = np.nanprod(in_np, keepdims=keepdims)

        assert allclose(out_num, out_np, rtol=1e-4)
This test checks if nanprod works as expected for complex
        datatypes. The parametrized datatype is that of real/complex
        component, so float32 would correspond to complex64.
        
tests/integration/test_nan_reduction.py