Skip to content

Commit

Permalink
TEST: Check SurfaceDataFile retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Feb 25, 2022
1 parent add2fc0 commit 23e34f9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nibabel/cifti2/tests/test_caretspec.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from pathlib import Path
import unittest

from nibabel.cifti2.caretspec import *

from nibabel.testing import data_path
from nibabel.optpkg import optional_package

requests, has_requests, _ = optional_package('requests')


def test_CaretSpecFile():
Expand All @@ -16,3 +20,16 @@ def test_CaretSpecFile():
assert isinstance(df, CaretSpecDataFile)
if df.data_file_type == 'SURFACE':
assert isinstance(df, SurfaceDataFile)


@unittest.skipUnless(has_requests, reason="Test fetches from URL")
def test_SurfaceDataFile():
fsLR = CaretSpecFile.from_filename(Path(data_path) / "fsLR.wb.spec")
df = fsLR.data_files[0]
assert df.data_file_type == 'SURFACE'
try:
coords, triangles = df.get_mesh()
except IOError:
raise unittest.SkipTest(reason="Broken URL")
assert coords.shape == (32492, 3)
assert triangles.shape == (64980, 3)

0 comments on commit 23e34f9

Please sign in to comment.