
    Og                     @    d Z ddlZ G d dej                        Zd Zy)zPure-Python hookable tests
    Nc                   N    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zy)HookableTestsc                 <    ddl m} | j                  t        |       y )Nr   hookablezope.component.hookabler   assertRaises	TypeError)selfr   s     ]/var/www/djangounited/venv/lib/python3.12/site-packages/zope/component/tests/test_hookable.pytest_ctor_no_funczHookableTests.test_ctor_no_func   s    4)X.    c                     ddl m} d } ||      }| j                  |j                  |u        | j                  |j                  |u        y )Nr   r   c                       y N r   r   r   fooz+HookableTests.test_ctor_simple.<locals>.foo       r   )r	   r   
assertTrueoriginalimplementationr   r   r   hookeds       r   test_ctor_simplezHookableTests.test_ctor_simple   s?    4	#3./--45r   c                 F    ddl m} d }| j                  t        |||       y )Nr   r   c                       y r   r   r   r   r   r   z.HookableTests.test_ctor_extra_arg.<locals>.foo#   r   r   r   r   r   r   s      r   test_ctor_extra_argz!HookableTests.test_ctor_extra_arg!   s    4	)XsC8r   c                 H    ddl m} d }| j                  t        |||       y )Nr   r   c                       y r   r   r   r   r   r   z3HookableTests.test_ctor_extra_arg_miss.<locals>.foo)   r   r   )nonesuchr   r   s      r   test_ctor_extra_arg_missz&HookableTests.test_ctor_extra_arg_miss'   s!    4	)XsSAr   c                     ddl m} d }d } ||      }|j                  |       | j                  |j                  |u        | j                  |j
                  |u        y )Nr   r   c                       y r   r   r   r   r   r   z'HookableTests.test_sethook.<locals>.foo/   r   r   c                       y r   r   r   r   r   barz'HookableTests.test_sethook.<locals>.bar1   r   r   )r	   r   sethookr   r   r   r   r   r   r'   r   s        r   test_sethookzHookableTests.test_sethook-   sP    4		#s3./--45r   c                     ddl m} d }d } ||      }|j                  |       |j                          | j	                  |j
                  |u        | j	                  |j                  |u        y )Nr   r   c                       y r   r   r   r   r   r   z%HookableTests.test_reset.<locals>.foo:   r   r   c                       y r   r   r   r   r   r'   z%HookableTests.test_reset.<locals>.bar<   r   r   )r	   r   r(   resetr   r   r   r)   s        r   
test_resetzHookableTests.test_reset8   sY    4		#s3./--45r   c                     ddl m} d }d } ||      }	 ||_        | j                  d       y # t        $ r Y y t
        $ r Y y w xY w)Nr   r   c                       y r   r   r   r   r   r   z4HookableTests.test_cant_assign_original.<locals>.fooF   r   r   c                       y r   r   r   r   r   r'   z4HookableTests.test_cant_assign_original.<locals>.barH   r   r   zAssigned originalr	   r   r   failr   AttributeErrorr)   s        r   test_cant_assign_originalz'HookableTests.test_cant_assign_originalD   sR    4		#	+!FO II)*  	 		   / 	AAAc                     ddl m} d } ||      }	 |`| j                  d       y # t        $ r Y y t
        $ r Y y w xY w)Nr   r   c                       y r   r   r   r   r   r   z4HookableTests.test_cant_delete_original.<locals>.fooV   r   r   zDeleted originalr3   r   s       r   test_cant_delete_originalz'HookableTests.test_cant_delete_originalT   sK    4	#	* II()  	 		   ' 	===c                     ddl m} d }d } ||      }	 ||_        | j                  d       y # t        $ r Y y t
        $ r Y y w xY w)Nr   r   c                       y r   r   r   r   r   r   z:HookableTests.test_cant_assign_implementation.<locals>.food   r   r   c                       y r   r   r   r   r   r'   z:HookableTests.test_cant_assign_implementation.<locals>.barf   r   r   zAssigned implementationr	   r   r   r4   r   r5   r)   s        r   test_cant_assign_implementationz-HookableTests.test_cant_assign_implementationb   sS    4		#	1$'F! II/0  	 		r7   c                     ddl m} d } ||      }	 |`| j                  d       y # t        $ r Y y t
        $ r Y y w xY w)Nr   r   c                       y r   r   r   r   r   r   z:HookableTests.test_cant_delete_implementation.<locals>.foot   r   r   zDeleted implementationr?   r   s       r   test_cant_delete_implementationz-HookableTests.test_cant_delete_implementationr   sL    4	#	0% II./  	 		r;   c                 t    ddl m} g fd} ||      } |ddd       | j                  dd	difg       y )
Nr   r   c                  ,    j                  | |f       y r   )append)argskw_calleds     r   r   z-HookableTests.test_ctor___call__.<locals>.foo   s    NND":&r   onetwobaz)r'   )rJ   rK   r'   )r	   r   assertEqual)r   r   r   r   rI   s       @r   test_ctor___call__z HookableTests.test_ctor___call__   sA    4	'#ue'NUEN#C"DEr   N)__name__
__module____qualname__r   r   r   r#   r*   r/   r6   r:   r@   rC   rN   r   r   r   r   r      s;    /69B	6
6+ *1 0Fr   r   c                  \    t        j                  t        j                  t              f      S r   )unittest	TestSuite	makeSuiter   r   r   r   
test_suiterV      s(    =)  r   )__doc__rS   TestCaser   rV   r   r   r   <module>rY      s)    tFH%% tFnr   