File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11from pathlib import Path
2+ import unittest
23
34from nibabel .cifti2 .caretspec import *
45
56from nibabel .testing import data_path
7+ from nibabel .optpkg import optional_package
8+
9+ requests , has_requests , _ = optional_package ('requests' )
610
711
812def test_CaretSpecFile ():
@@ -16,3 +20,16 @@ def test_CaretSpecFile():
1620 assert isinstance (df , CaretSpecDataFile )
1721 if df .data_file_type == 'SURFACE' :
1822 assert isinstance (df , SurfaceDataFile )
23+
24+
25+ @unittest .skipUnless (has_requests , reason = "Test fetches from URL" )
26+ def test_SurfaceDataFile ():
27+ fsLR = CaretSpecFile .from_filename (Path (data_path ) / "fsLR.wb.spec" )
28+ df = fsLR .data_files [0 ]
29+ assert df .data_file_type == 'SURFACE'
30+ try :
31+ coords , triangles = df .get_mesh ()
32+ except IOError :
33+ raise unittest .SkipTest (reason = "Broken URL" )
34+ assert coords .shape == (32492 , 3 )
35+ assert triangles .shape == (64980 , 3 )
You can’t perform that action at this time.
0 commit comments