
    "Kb                         d Z ddlZddlZddlZ G d dej                  Z G d dej                  Zedk    r ej	                     dS dS )z"Unit tests for the common.py file.    Nc                       e Zd Zd Zd ZdS )TestTopologicallySortedc                     ddgg dgdgdfd}|                      t          j                                                            |          g d           dS )zATest that sorting works on a valid graph with one possible order.bcdar   r   r   c                 .    t          |                    S Ntuplenodegraphs    1/usr/lib/python3/dist-packages/gyp/common_test.pyGetEdgez3TestTopologicallySorted.test_Valid.<locals>.GetEdge       5;    )r
   r   r   r   N)assertEqualgypcommonTopologicallySortedkeysselfr   r   s     @r   
test_Validz"TestTopologicallySorted.test_Valid   s     3ZUU	
 
E         	j$$UZZ\\7;;    r   c                     dgdgdgdgdfd}|                      t          j        j        t          j        j                                        |           dS )z3Test that an exception is thrown on a cyclic graph.r   r   r   r
   r	   c                 .    t          |                    S r   r   r   s    r   r   z3TestTopologicallySorted.test_Cycle.<locals>.GetEdge%   r   r   N)assertRaisesr   r   
CycleErrorr   r   r   s     @r   
test_Cyclez"TestTopologicallySorted.test_Cycle   s|     UUUU	
 
E         	jSZ;jjllG    r   N)__name__
__module____qualname__r   r"    r   r   r   r      s2              r   r   c                   4    e Zd ZdZdZd Zd Zd Zd Zd Z	dS )	TestGetFlavorz0Test that gyp.common.GetFlavor works as intended c                 (    t           j        | _        d S r   )sysplatformoriginal_platformr   s    r   setUpzTestGetFlavor.setUp0   s     \Dr   c                 (    | j         t          _        d S r   )r-   r+   r,   r.   s    r   tearDownzTestGetFlavor.tearDown3   s    )CLLLr   c                     |t           _        |                     |t          j                            |                     d S r   )r+   r,   r   r   r   	GetFlavor)r   expectedargumentparams       r   assertFlavorzTestGetFlavor.assertFlavor6   s5    CLXsz33E::;;;;;r   c                 v   |                      ddi            |                      ddi            |                      ddi            |                      ddi            |                      ddi            |                      d	d
i            |                      d	di            |                      d	d	i            d S )Nfreebsdfreebsd9	freebsd10openbsdopenbsd5solarissunos5sunoslinuxlinux2linux3r7   r.   s    r   test_platform_defaultz#TestGetFlavor.test_platform_default:   s    ib111ib111ib111ib111ib111gb111gb111gb11111r   c                 8    |                      ddddi           d S )NfoobarrB   flavorrD   r.   s    r   
test_paramzTestGetFlavor.test_paramD   s%    hHh+?@@@@@r   N)
r#   r$   r%   __doc__r-   r/   r1   r7   rE   rI   r&   r   r   r(   r(   ,   sp        88* * ** * *< < <3 3 3A A A A Ar   r(   __main__)
rJ   
gyp.commonr   unittestr+   TestCaser   r(   r#   mainr&   r   r   <module>rP      s    ) (      



    h/   <A A A A AH% A A A8 z(-///// r   