# Path: impyute/dataset/base.py
# def mnist(missingness="mcar", thr=0.2):
#     """ Loads corrupted MNIST
# 
#     Parameters
#     ----------
#     missingness: ('mcar', 'mar', 'mnar')
#         Type of missigness you want in your dataset
#     th: float between [0,1]
#         Percentage of missing data in generated data
# 
#     Returns
#     -------
#     numpy.ndarray
#     """
#     from sklearn.datasets import fetch_mldata
#     dataset = fetch_mldata('MNIST original')
#     corruptor = Corruptor(dataset.data, thr=thr)
#     data = getattr(corruptor, missingness)()
#     return {"X": data, "Y": dataset.target}
# 
# Path: impyute/ops/matrix.py
# def nan_indices(data):
# def map_nd(fn, arr):
# def every_nd(fn, arr):


import numpy as np
import pytest
from impyute.dataset import mnist
from impyute.ops import matrix

pytest.skip("takes ~30 sec each test", allow_module_level=True)
data = mnist()["X"]

def test_return_type():
    """ Check return type, should return an np.ndarray"""
    assert isinstance(data, np.ndarray)

def test_missing_values_present():
    """ Check that the dataset is corrupted (missing values present)"""

# Path: impyute/dataset/base.py
# def mnist(missingness="mcar", thr=0.2):
#     """ Loads corrupted MNIST
# 
#     Parameters
#     ----------
#     missingness: ('mcar', 'mar', 'mnar')
#         Type of missigness you want in your dataset
#     th: float between [0,1]
#         Percentage of missing data in generated data
# 
#     Returns
#     -------
#     numpy.ndarray
#     """
#     from sklearn.datasets import fetch_mldata
#     dataset = fetch_mldata('MNIST original')
#     corruptor = Corruptor(dataset.data, thr=thr)
#     data = getattr(corruptor, missingness)()
#     return {"X": data, "Y": dataset.target}
# 
# Path: impyute/ops/matrix.py
# def nan_indices(data):
# def map_nd(fn, arr):
# def every_nd(fn, arr):


# Path: test/dataset/test_mnist.py
import numpy as np
import pytest
from impyute.dataset import mnist
from impyute.ops import matrix


pytest.skip("takes ~30 sec each test", allow_module_level=True)
data = mnist()["X"]

def test_return_type():
    """ Check return type, should return an np.ndarray"""
    assert isinstance(data, np.ndarray)

def test_missing_values_present():
    """ Check that the dataset is corrupted (missing values present)"""

    assert matrix.nan_indices(data).size != 0