"""
Test the nifti_masker module
"""
# Author: Gael Varoquaux
# License: simplified BSD


import numpy as np

from nibabel import Nifti1Image

from ..nifti_masker import NiftiMasker

def test_auto_mask():
    data = np.ones((9, 9, 9))
    data[3:-3, 3:-3, 3:-3] = 10
    img = Nifti1Image(data, np.eye(4))
    masker = NiftiMasker()
    masker.fit(img)


@@ -82,16 +82,64 @@
 ed BSD%0A%0A
+from nose.tools import assert_true, assert_false
 %0Aimport 
@@ -395,8 +395,613 @@
 t(img)%0A%0A
+def test_nan():%0A    data = np.ones((9, 9, 9))%0A    data%5B0%5D = np.nan%0A    data%5B:, 0%5D = np.nan%0A    data%5B:, :, 0%5D = np.nan%0A    data%5B-1%5D = np.nan%0A    data%5B:, -1%5D = np.nan%0A    data%5B:, :, -1%5D = np.nan%0A    data%5B3:-3, 3:-3, 3:-3%5D = 10%0A    img = Nifti1Image(data, np.eye(4))%0A    masker = NiftiMasker()%0A    masker.fit(img)%0A    mask = masker.mask_.get_data()%0A    assert_true(mask%5B1:-1, 1:-1, 1:-1%5D.all())%0A    assert_false(mask%5B0%5D.any())%0A    assert_false(mask%5B:, 0%5D.any())%0A    assert_false(mask%5B:, :, 0%5D.any())%0A    assert_false(mask%5B-1%5D.any())%0A    assert_false(mask%5B:, -1%5D.any())%0A    assert_false(mask%5B:, :, -1%5D.any())%0A

Add test for NaN input values