File: interfaces_test.py

package info (click to toggle)
pyxnat 1.0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,124 kB
  • sloc: python: 5,904; makefile: 17
file content (32 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from .. import Interface

central = Interface(config=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'central.cfg'))
central_anon = Interface('https://central.xnat.org', anonymous=True)

def test_simple_object_listing():
    assert isinstance(central.select.projects().get(), list)

def test_simple_path_listing():
    assert isinstance(central.select('/projects').get(), list)

def test_nested_object_listing():
    assert isinstance(central.select.projects('*OASIS*').subjects().get(), list)

def test_nested_path_listing():
    assert isinstance(central.select('/projects/*OASIS*/subjects').get(), list)

# def test_nested_for_access():
#     stop = False
#     for subject in central.select('/projects/*OASIS*/subjects'):
#         for f in subject.experiments().scans().resources().files():
#             assert isinstance(f._uri, (str, unicode))
#             stop =True
#             break
#         if stop:
#             break

def test_anonymous_access():
    projects = central_anon.select.projects().get()
    assert isinstance(projects, list)
    assert list