3
rdu
                 @   sV   d dl Z d dljZd dlmZ ddlmZ d dlZ	e	j
e	jd G dd de jZdS )    N)	Interface   )skip_if_no_network)levelc               @   sT   e Zd ZdZdd Zedd Zedd Zedd	 Zed
d Z	edd Z
dS )
ArrayTestsz/ Resource-related XNAT connectivity test cases c             C   s(   t jt jt jtd}t|d| _d S )Nzcentral.cfg)config)opjoindirnameabspath__file__r   _intf)selffp r   9/tmp/pip-build-7vycvbft/pyxnat/pyxnat/tests/array_test.pysetUp   s    zArrayTests.setUpc             C   s&   | j jjddj}| jt|d dS )z
        Get a list of experiments from a given subject which has multiple types
        of experiments (i.e. MRSessions and PETSessions) and assert it gathers
        them all.
        CENTRAL_S06242)
subject_id   N)r   arrayexperimentsdataassertGreaterEquallen)r   er   r   r   test_array_experiments   s    z!ArrayTests.test_array_experimentsc             C   s:   | j jjddj}| j jjddd}|j}| j|| dS )z
        From a given subject which has multiple types of experiments, get a
        list of MRI sessions and assert its length matches the list of
        experiments of type 'xnat:mrSessionData'
        r   )r   zxnat:mrSessionData)r   experiment_typeN)r   r   Z
mrsessionsr   r   assertListEqual)r   mrisr   expsr   r   r   test_array_mrsessions   s
    
z ArrayTests.test_array_mrsessionsc             C   s&   | j jjddj}| jt|d dS )z
        Get a list of scans from a given experiment which has multiple types
        of scans (i.e. PETScans and CTScans) and assert it gathers them all.
        CENTRAL_E72012)experiment_id   N)r   r   scansr   ZassertEqualr   )r   sr   r   r   test_array_scans'   s    zArrayTests.test_array_scansc             C   sJ   | j jjddj}| j jjdddj}| jdd |D dd |D  dS )	a  
        Get a list of MRI scans from a given experiment which has multiple
        scans mixed (i.e. MRScans and MRSpectroscopies, aka OtherDicomScans)
        and assert its length matches the list of scans filtered by type
        'xnat:mrScanData'
        r"   )r#   zxnat:mrScanData)r#   Z	scan_typec             S   s   g | ]}|d  qS )zxnat:mrscandata/idr   ).0ir   r   r   
<listcomp>;   s    z1ArrayTests.test_array_mrscans.<locals>.<listcomp>c             S   s   g | ]}|d  qS )zxnat:mrscandata/idr   )r(   r)   r   r   r   r*   <   s    N)r   r   Zmrscansr   r%   r   )r   r   r    r   r   r   test_array_mrscans0   s
    

zArrayTests.test_array_mrscansc             C   s0   d}| j jjd|d}|j}| jt|d d S )Nzxnat:subjectDataZ
nosetests5)Z
project_idr   r   )r   r   Zsearch_experimentsr   r   r   )r   etr   resr   r   r   test_search_experiments>   s
    
z"ArrayTests.test_search_experimentsN)__name__
__module____qualname____doc__r   r   r   r!   r'   r+   r.   r   r   r   r   r   	   s   
	r   )Zunittestos.pathpathr   Zpyxnatr    r   logginglogbasicConfigINFOZTestCaser   r   r   r   r   <module>   s   
