B
    '(b                 @   s   d Z ddlZddlmZmZmZmZ ddlmZm	Z	 ddl
mZmZmZ ddlmZ ddl
mZmZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ G dd de	Z dS )z1Test cases for graph processing code in build.py.    N)AbstractSetDictSetList)assert_equalSuite)BuildManagerStateBuildSourceSet)SearchPaths)topsortstrongly_connected_componentssorted_components
order_ascc)__version__)Options)Reports)Plugin)Errors)FileSystemCachec               @   sR   e Zd ZddddZddddZedddZddd	d
ZddddZdS )
GraphSuiteN)returnc             C   sh   t dh}t dh}t dh}t dh}|||h||h||hi}tt|}t||h||h|hg d S )NABCD)	frozensetlistr   r   )selfabcddatares r%   B/home/dcms/DCMS/lib/python3.7/site-packages/mypy/test/testgraph.pytest_topsort   s    



zGraphSuite.test_topsortc             C   s`   ddddh}ddgdgddgg d}dd t ||D }t|tdhtddhtdhh d S )Nr   r   r   r   )r   r   r   r   c             S   s   h | ]}t |qS r%   )r   ).0xr%   r%   r&   	<setcomp>    s    z&GraphSuite.test_scc.<locals>.<setcomp>)r   r   r   )r   ZverticesedgesZsccsr%   r%   r&   test_scc   s    
zGraphSuite.test_sccc             C   s^   t  }t }t }tdddd}td|dtg tdi |tt|i |dd |t	j
t	jd}|S )Nr%    c             S   s   d S )Nr%   )ZmsgsZseriousr%   r%   r&   <lambda>6       z*GraphSuite._make_manager.<locals>.<lambda>)data_dirsearch_pathsZignore_prefixZ
source_setZreportsoptions
version_idZpluginZplugins_snapshoterrorsZflush_errorsfscachestdoutstderr)r   r   r   r   r   r
   r   r   r   sysr6   r7   )r   r4   r2   r5   r1   managerr%   r%   r&   _make_manager&   s(    
zGraphSuite._make_managerc             C   sn   |   }tdd d|tdd d|tdd d|tdd d|d	}t|}t|tdhtddhtdhg d S )
Nr   zimport b, cr"   passr    zimport cr!   zimport b, d)r   r"   r    r!   )r:   r	   r   r   r   )r   r9   graphr$   r%   r%   r&   test_sorted_components=   s    z!GraphSuite.test_sorted_componentsc             C   s   |   }tdd d|tdd d|tdd d|tdd d|d	}t|}t|tddddhg |d
 }t||}t|ddddg d S )Nr   zimport b, cr"   zdef f(): import ar    zimport cr!   zimport b, d)r   r"   r    r!   r   )r:   r	   r   r   r   r   )r   r9   r<   r$   ZasccZsccr%   r%   r&   test_order_asccG   s    
zGraphSuite.test_order_ascc)	__name__
__module____qualname__r'   r,   r   r:   r=   r>   r%   r%   r%   r&   r      s
   		
r   )!__doc__r8   typingr   r   r   r   Zmypy.test.helpersr   r   Z
mypy.buildr   r	   r
   Zmypy.modulefinderr   r   r   r   r   Zmypy.versionr   Zmypy.optionsr   Zmypy.reportr   Zmypy.pluginr   Zmypy.errorsr   Zmypy.fscacher   r   r%   r%   r%   r&   <module>   s   