3
6ßL]€	  ã               @   sj   d Z ddlmZmZmZ ddlmZmZ ddlm	Z	 G dd„ deƒZ
G dd„ de	jƒZed	krfe	jƒ  d
S )z% Tests for the 'Service' trait type. é    )ÚApplicationÚPluginÚService)Ú	HasTraitsÚInstance)Úunittestc               @   s   e Zd ZdZdZdS )ÚTestApplicationz, The type of application used in the tests. ÚtestN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úid© r   r   úF/tmp/pip-install-5sebvq2j/envisage/envisage/tests/service_test_case.pyr   
   s   r   c               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚServiceTestCasez% Tests for the 'Service' trait type. c             C   s   dS )z> Prepares the test fixture before each test method is called. Nr   )Úselfr   r   r   ÚsetUp   s    zServiceTestCase.setUpc             C   s   dS )z< Called immediately after each test method has been called. Nr   )r   r   r   r   ÚtearDown   s    zServiceTestCase.tearDownc                s–   G dd„ dt ƒ‰ G ‡ fdd„dtƒ}G ‡ fdd„dtƒ}|ƒ }|ƒ }t||gd�}|jƒ  | j|j|jƒ |jƒ  | jd|jƒ | jtt	|d	d
ƒ dS )z service trait typec               @   s   e Zd ZdS )z4ServiceTestCase.test_service_trait_type.<locals>.FooN)r
   r   r   r   r   r   r   ÚFoo(   s   r   c                   s   e Zd ZdZe” f dd�ZdS )z8ServiceTestCase.test_service_trait_type.<locals>.PluginAÚAT)ZserviceN)r
   r   r   r   r   Úfoor   )r   r   r   ÚPluginA+   s   r   c                   s   e Zd ZdZe” ƒZdS )z8ServiceTestCase.test_service_trait_type.<locals>.PluginBÚBN)r
   r   r   r   r   r   r   )r   r   r   ÚPluginB/   s   r   )ZpluginsNr   Zbogus)
r   r   r   ÚstartZassertEqualr   ÚstopÚfailUnlessRaisesÚSystemErrorÚsetattr)r   r   r   ÚaÚbZapplicationr   )r   r   Útest_service_trait_type%   s    z'ServiceTestCase.test_service_trait_typec                s>   G dd„ dt ƒ‰ G ‡ fdd„dt ƒ}|ƒ }| jtt|dƒ dS )z- service trait type with no service registry c               @   s   e Zd ZdS )zMServiceTestCase.test_service_trait_type_with_no_service_registry.<locals>.FooN)r
   r   r   r   r   r   r   r   J   s   r   c                   s   e Zd Ze” ƒZdS )zMServiceTestCase.test_service_trait_type_with_no_service_registry.<locals>.BarN)r
   r   r   r   r   r   )r   r   r   ÚBarM   s   r#   r   N)r   r   Ú
ValueErrorÚgetattr)r   r#   r!   r   )r   r   Ú0test_service_trait_type_with_no_service_registryG   s
    z@ServiceTestCase.test_service_trait_type_with_no_service_registryN)r
   r   r   r   r   r   r"   r&   r   r   r   r   r      s
   	"r   Ú__main__N)r   Zenvisage.apir   r   r   Z
traits.apir   r   Ztraits.testing.unittest_toolsr   r   ZTestCaser   r
   Úmainr   r   r   r   Ú<module>   s   I