Coverage for nilearn/plotting/displays/tests/test_edge_detect.py: 0%

14 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-16 12:32 +0200

1import numpy as np 

2 

3from nilearn.plotting.displays.edge_detect import _edge_detect 

4 

5 

6def test_edge_detect(): 

7 img = np.zeros((10, 10)) 

8 img[:5] = 1 

9 _, _ = _edge_detect(img) 

10 np.testing.assert_almost_equal(img[4], 1) 

11 

12 

13def test_edge_nan(): 

14 img = np.zeros((10, 10)) 

15 img[:5] = 1 

16 img[0] = np.nan 

17 grad_mag, _ = _edge_detect(img) 

18 np.testing.assert_almost_equal(img[4], 1) 

19 assert (grad_mag[0] > 2).all()