File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
from pathlib import Path
2
+ import unittest
2
3
3
4
from nibabel .cifti2 .caretspec import *
4
5
5
6
from nibabel .testing import data_path
7
+ from nibabel .optpkg import optional_package
8
+
9
+ requests , has_requests , _ = optional_package ('requests' )
6
10
7
11
8
12
def test_CaretSpecFile ():
@@ -16,3 +20,16 @@ def test_CaretSpecFile():
16
20
assert isinstance (df , CaretSpecDataFile )
17
21
if df .data_file_type == 'SURFACE' :
18
22
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