
    OgX                     >   d Z ddlZ G d dej                        Z G d dej                        Z G d dej                        Z G d	 d
ej                        Z G d dej                        Z G d dej                        Z G d dej                        Z	 G d dej                        Z
 G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d d ej                        Z G d! d"ej                        Z G d# d$ej                        Z G d% d&ej                        Z G d' d(ej                        Zdad) Zd* Zy)+z Tests for z.c._api
    Nc                   F    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zd	 Zy
)Test_getSiteManagerr   setUptearDownc                     ddl m}  ||i |S )Nr   )getSiteManager)zope.component._apir	   )selfargskwr	   s       Y/var/www/djangounited/venv/lib/python3.12/site-packages/zope/component/tests/test__api.py_callFUTzTest_getSiteManager._callFUT   s    6t*r**    c                 p    ddl m} | j                         }| j                  |j	                  |             y )Nr   IComponentLookup)zope.component.interfacesr   r   
assertTrue
providedBy)r   r   sms      r   test_sm_is_IComponentLookupz/Test_getSiteManager.test_sm_is_IComponentLookup   s(    >]]_(33B78r   c                     ddl m} | j                         }| j                  ||u        | j                  | j                         |u        y )Nr   )base)zope.component.globalregistryr   r   r   )r   r   r   s      r   test_sm_is_singletonz(Test_getSiteManager.test_sm_is_singleton    s7    6]]_d
#2-.r   c                 d    | j                  | j                  d       | j                         u        y N)r   r   )r   s    r   test_w_NonezTest_getSiteManager.test_w_None&   s"    d+t}}>?r   c                 x    ddl m} t               } ||      }| j                  | j	                  |      |u        y )Nr   ConformsToIComponentLookup)zope.component.tests.examplesr"   objectr   r   )r   r"   sitemanagercontexts       r   (test_getSiteManager_w_conforming_contextz<Test_getSiteManager.test_getSiteManager_w_conforming_context)   s0    Lh,[9g.+=>r   c                 Z    ddl m} | j                  || j                  t	                      y )Nr   ComponentLookupError)r   r*   assertRaisesr   r$   r   r*   s     r   0test_getSiteManager_w_invalid_context_no_adapterzDTest_getSiteManager.test_getSiteManager_w_invalid_context_no_adapter/   s    B.vxHr   c                     ddl m} ddlm} ddlm}  |       }t               fd}|j                  ||f|d       | j                  | j                  t                     u        y )Nr   	InterfacegetGlobalSiteManagerr   c                     S r    )xr   s    r   _adaptzSTest_getSiteManager.test_getSiteManager_w_invalid_context_w_adapter.<locals>._adapt9   s    Ir    )
zope.interfacer0   r   r2   r   r   r$   registerAdapterr   r   )r   r0   r2   r   gsmr6   r   s         @r   /test_getSiteManager_w_invalid_context_w_adapterzCTest_getSiteManager.test_getSiteManager_w_invalid_context_w_adapter3   sS    ,F>"$X	FYL2BBGfh/256r   N)__name__
__module____qualname__zope.component.testingr   r   r   r   r   r   r'   r-   r;   r4   r   r   r   r      s*    6+9
/@?I	7r   r   c                   .    e Zd ZddlmZmZ d Zd Zd Zy)Test_getAdapterInContextr   r   c                     ddl m}  ||i |S )Nr   )getAdapterInContext)zope.componentrC   )r   r   r   rC   s       r   r   z!Test_getAdapterInContext._callFUTC   s    6"D/B//r   c                     ddl m} ddlm}  G d d|      }| j	                  || j
                  t               |d        y )Nr   r/   r)   c                       e Zd Zy)0Test_getAdapterInContext.test_miss.<locals>.IFooNr<   r=   r>   r4   r   r   IFoorG   J       r   rI   r&   r8   r0   r   r*   r+   r   r$   r   r0   r*   rI   s       r   	test_missz"Test_getAdapterInContext.test_missG   s:    ,B	9 	.--4 	 	Gr   c                 L   ddl m} ddl m} ddlm} ddlm} ddlm}  G d d|      } G d	 d
|      } ||       G d dt                     } ||       G d dt                     }	 ||       G d dt                     }
 G d d|      } |       }|j                  ||f|d        |d|f      }|j                  |	|f|d        |
       }| j                  || ||            }| j                  |j                  |	u        | j                  |j                  |u        y )Nr   r/   implementer
Componentsr1   r!   c                       e Zd Zy)6Test_getAdapterInContext.test_hit_via_sm.<locals>.IFooNrH   r4   r   r   rI   rU   U   rJ   r   rI   c                       e Zd Zy)6Test_getAdapterInContext.test_hit_via_sm.<locals>.IBarNrH   r4   r   r   IBarrW   W   rJ   r   rX   c                       e Zd Zd Zy)8Test_getAdapterInContext.test_hit_via_sm.<locals>.Globalc                     || _         y r   rK   r   r&   s     r   __init__zATest_getAdapterInContext.test_hit_via_sm.<locals>.Global.__init__[   	    &r   Nr<   r=   r>   r]   r4   r   r   GlobalrZ   Y       'r   r`   c                       e Zd Zd Zy)7Test_getAdapterInContext.test_hit_via_sm.<locals>.Localc                     || _         y r   rK   r\   s     r   r]   z@Test_getAdapterInContext.test_hit_via_sm.<locals>.Local.__init___   r^   r   Nr_   r4   r   r   Localrc   ]   ra   r   re   c                       e Zd Zy)5Test_getAdapterInContext.test_hit_via_sm.<locals>.BarNrH   r4   r   r   Barrg   a       r   rh   c                       e Zd Zd Zy)9Test_getAdapterInContext.test_hit_via_sm.<locals>.Contextc                     || _         y r   r%   r   r   s     r   r]   zBTest_getAdapterInContext.test_hit_via_sm.<locals>.Context.__init__e   
    #% r   Nr_   r4   r   r   Contextrk   d       &r   rp   r7   sm1basesrK   r8   r0   rQ   zope.interface.registryrS   rD   r2   r#   r"   r$   r9   r   r   	__class__r&   r   r0   rQ   rS   r2   r"   rI   rX   r`   re   rh   rp   r:   rr   baradapteds                   r   test_hit_via_smz(Test_getAdapterInContext.test_hit_via_smO   s#   ,.67L	9 		9 		T		'V 	' 
	' 
T		'F 	' 
	' 
T		& 	 
		&0 	& #$FTGT26sg.ED7D"5e--T73<-@))U233./r   N)	r<   r=   r>   r?   r   r   r   rN   r{   r4   r   r   rA   rA   ?   s    60G0r   rA   c                   @    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zy	)
Test_queryAdapterInContextr   r   c                     ddl m}  ||i |S )Nr   queryAdapterInContext)rD   r   )r   r   r   r   s       r   r   z#Test_queryAdapterInContext._callFUTu   s    8$d1b11r   c                 x    ddl m} ddlm}  G d d|      }| j	                   |t               |d       d        y )Nr   r/   r   c                       e Zd Zy)2Test_queryAdapterInContext.test_miss.<locals>.IFooNrH   r4   r   r   rI   r   |   rJ   r   rI   rK   )r8   r0   rD   r   assertEqualr$   )r   r0   r   rI   s       r   rN   z$Test_queryAdapterInContext.test_missy   s3    ,8	9 	!&(D$?	Gr   c                     ddl m} ddlm}  G d d|      t	                G fddt              }| j                   | |       d       u        y )	Nr   r/   r   c                       e Zd Zy)ATest_queryAdapterInContext.test_w_object_conforming.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd Zd fd	Zy)@Test_queryAdapterInContext.test_w_object_conforming.<locals>.FooNc                     |u rS |S r   r4   r   ifacedefaultrI   _adapteds      r   __conform__zLTest_queryAdapterInContext.test_w_object_conforming.<locals>.Foo.__conform__       D=#Or   r   r<   r=   r>   r   rI   r   s   r   Foor          r   r   rK   )r8   r0   rD   r   r$   r   r   r0   r   r   rI   r   s       @@r   test_w_object_conformingz3Test_queryAdapterInContext.test_w_object_conforming   sJ    ,8	9 	8	& 	
 	%ceT4@HL	Nr   c                     ddl m} ddlm}  G d d|      t	                G fddt              }| j                   ||d       d        y )	Nr   r/   r   c                       e Zd Zy)TTest_queryAdapterInContext.test___conform___raises_TypeError_via_class.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd Zd fd	Zy)STest_queryAdapterInContext.test___conform___raises_TypeError_via_class.<locals>.FooNc                     |u rS |S r   r4   r   s      r   r   z_Test_queryAdapterInContext.test___conform___raises_TypeError_via_class.<locals>.Foo.__conform__   r   r   r   r   r   s   r   r   r      r   r   r   rK   )r8   r0   rD   r   r$   r   r   s       @@r   +test___conform___raises_TypeError_via_classzFTest_queryAdapterInContext.test___conform___raises_TypeError_via_class   sD    ,8	9 	8	& 	 	.sD$GNr   c                     ddl m} ddlm}  G d d|      }t	               } G d dt              }| j                  t        | |       |d        y )	Nr   r/   r   c                       e Zd Zy)STest_queryAdapterInContext.test___conform___raises_TypeError_via_inst.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd ZddZy)RTest_queryAdapterInContext.test___conform___raises_TypeError_via_inst.<locals>.FooNc                     t         r   )	TypeError)r   r   r   s      r   r   z^Test_queryAdapterInContext.test___conform___raises_TypeError_via_inst.<locals>.Foo.__conform__   s    r   r   r   r4   r   r   r   r      s     r   r   rK   )r8   r0   rD   r   r$   r+   r   )r   r0   r   rI   r   r   s         r   *test___conform___raises_TypeError_via_instzETest_queryAdapterInContext.test___conform___raises_TypeError_via_inst   sJ    ,8	9 	8	 & 	  	).tT 	 	Kr   c                     ddl m} ddl m} ddlm}  G d d|      } ||       G d dt
                     } |       }| j                   |||d 	      |u        y )
Nr   r/   rP   r   c                       e Zd Zy)CTest_queryAdapterInContext.test_w_object_implementing.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd Zy)BTest_queryAdapterInContext.test_w_object_implementing.<locals>.FooNrH   r4   r   r   r   r      s    r   r   rK   )r8   r0   rQ   rD   r   r$   r   )r   r0   rQ   r   rI   r   foos          r   test_w_object_implementingz5Test_queryAdapterInContext.test_w_object_implementing   sZ    ,.8	9 		T		& 	 
	e%c4>#E	Gr   N)r<   r=   r>   r?   r   r   r   rN   r   r   r   r   r4   r   r   r}   r}   q   s(    62GNO
KGr   r}   c                   @    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zy	)
Test_getAdapterr   r   c                     ddl m}  ||i |S )Nr   )
getAdapter)rD   r   )r   r   r   r   s       r   r   zTest_getAdapter._callFUT   s    -4&2&&r   c                     ddl m} ddlm}  G d d|      }| j	                  || j
                  t               |d       y )Nr   r/   r)   c                       e Zd Zy)5Test_getAdapter.test_anonymous_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   r7   rL   rM   s       r   test_anonymous_nonesuchz'Test_getAdapter.test_anonymous_nonesuch   s4    ,B	9 	.--4	=r   c                     ddl m} ddlm}  G d d|      }| j	                  || j
                  t               |d       y )Nr   r/   r)   c                       e Zd Zy)1Test_getAdapter.test_named_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   ry   rL   rM   s       r   test_named_nonesuchz#Test_getAdapter.test_named_nonesuch   s5    ,B	9 	.--4	@r   c                    ddl m} ddl m} ddlm}  G d d|      } G d d|      } ||       G d	 d
t
                     } ||       G d dt
                     } |       j                  ||f|d        |       }| j                  ||d      }	| j                  |	j                  |u        | j                  |	j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)0Test_getAdapter.test_anonymous_hit.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd Zy)0Test_getAdapter.test_anonymous_hit.<locals>.IBarNrH   r4   r   r   rX   r      rJ   r   rX   c                       e Zd Zy)/Test_getAdapter.test_anonymous_hit.<locals>.BarNrH   r4   r   r   rh   r      ri   r   rh   c                       e Zd Zd Zy)/Test_getAdapter.test_anonymous_hit.<locals>.Bazc                     || _         y r   rK   r\   s     r   r]   z8Test_getAdapter.test_anonymous_hit.<locals>.Baz.__init__   r^   r   Nr_   r4   r   r   Bazr      ra   r   r   r7   r8   r0   rQ   rD   r2   r$   r9   r   r   rw   r&   
r   r0   rQ   r2   rI   rX   rh   r   ry   rz   s
             r   test_anonymous_hitz"Test_getAdapter.test_anonymous_hit       ,.7	9 		9 		T		& 	 
		T		'& 	' 
	' 	..sTGT2Fe--T2.))S013./r   c                 R   ddl m} ddl m} ddlm}  G d d|      } ||       G d dt
                     } |       j                  |d	|d
       t               }| j                  ||d
      }| j                  |j                  |u        | j                  |j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)DTest_getAdapter.test_anonymous_hit_registered_for_None.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd Zd Zy)CTest_getAdapter.test_anonymous_hit_registered_for_None.<locals>.Bazc                     || _         y r   rK   r\   s     r   r]   zLTest_getAdapter.test_anonymous_hit_registered_for_None.<locals>.Baz.__init__   r^   r   Nr_   r4   r   r   r   r      ra   r   r   r   r7   r   )r   r0   rQ   r2   rI   r   ctxrz   s           r   &test_anonymous_hit_registered_for_Nonez6Test_getAdapter.test_anonymous_hit_registered_for_None   s    ,.7	9 		T		'& 	' 
	' 	..sGT2Fh--T2.))S013./r   c                    ddl m} ddl m} ddlm}  G d d|      } G d d|      } ||       G d	 d
t
                     } ||       G d dt
                     } |       j                  ||f|d        |       }| j                  ||d      }	| j                  |	j                  |u        | j                  |	j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy),Test_getAdapter.test_named_hit.<locals>.IFooNrH   r4   r   r   rI   r      rJ   r   rI   c                       e Zd Zy),Test_getAdapter.test_named_hit.<locals>.IBarNrH   r4   r   r   rX   r      rJ   r   rX   c                       e Zd Zy)+Test_getAdapter.test_named_hit.<locals>.BarNrH   r4   r   r   rh   r      ri   r   rh   c                       e Zd Zd Zy)+Test_getAdapter.test_named_hit.<locals>.Bazc                     || _         y r   rK   r\   s     r   r]   z4Test_getAdapter.test_named_hit.<locals>.Baz.__init__  r^   r   Nr_   r4   r   r   r   r      ra   r   r   namedr   r   s
             r   test_named_hitzTest_getAdapter.test_named_hit       ,.7	9 		9 		T		& 	 
		T		'& 	' 
	' 	..sTGT7Ke--T73))S013./r   Nr<   r=   r>   r?   r   r   r   r   r   r   r   r   r4   r   r   r   r      s$    6'=@0*0 0r   r   c                   @    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zy	)
Test_queryAdapterr   r   c                     ddl m}  ||i |S )Nr   )queryAdapter)rD   r   )r   r   r   r   s       r   r   zTest_queryAdapter._callFUT      /T(R((r   c                 ~    ddl m}  G d d|      }| j                  | j                  t	               |dd      d       y )Nr   r/   c                       e Zd Zy)7Test_queryAdapter.test_anonymous_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r     rJ   r   rI   r7   	<default>r8   r0   r   r   r$   r   r0   rI   s      r   r   z)Test_queryAdapter.test_anonymous_nonesuch  s5    ,	9 	vxr;G$	&r   c                 |    ddl m}  G d d|      }| j                  | j                  t	               |d      d        y )Nr   r/   c                       e Zd Zy)3Test_queryAdapter.test_named_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r     rJ   r   rI   ry   r   r   s      r   r   z%Test_queryAdapter.test_named_nonesuch  s0    ,	9 	vxu=tDr   c                    ddl m} ddl m} ddlm}  G d d|      } G d d|      } ||       G d	 d
t
                     } ||       G d dt
                     } |       j                  ||f|d        |       }| j                  ||d      }	| j                  |	j                  |u        | j                  |	j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)2Test_queryAdapter.test_anonymous_hit.<locals>.IFooNrH   r4   r   r   rI   r   #  rJ   r   rI   c                       e Zd Zy)2Test_queryAdapter.test_anonymous_hit.<locals>.IBarNrH   r4   r   r   rX   r   %  rJ   r   rX   c                       e Zd Zy)1Test_queryAdapter.test_anonymous_hit.<locals>.BarNrH   r4   r   r   rh   r   '  ri   r   rh   c                       e Zd Zd Zy)1Test_queryAdapter.test_anonymous_hit.<locals>.Bazc                     || _         y r   rK   r\   s     r   r]   z:Test_queryAdapter.test_anonymous_hit.<locals>.Baz.__init__,  r^   r   Nr_   r4   r   r   r   r   *  ra   r   r   r7   r   r   s
             r   r   z$Test_queryAdapter.test_anonymous_hit  r   r   c                    ddl m} ddl m} ddlm}  G d d|      } G d d|      } ||       G d	 d
t
                     } ||       G d dt
                     } |       j                  ||f|d        |       }| j                  ||d      }	| j                  |	j                  |u        | j                  |	j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy).Test_queryAdapter.test_named_hit.<locals>.IFooNrH   r4   r   r   rI   r   8  rJ   r   rI   c                       e Zd Zy).Test_queryAdapter.test_named_hit.<locals>.IBarNrH   r4   r   r   rX   r   :  rJ   r   rX   c                       e Zd Zy)-Test_queryAdapter.test_named_hit.<locals>.BarNrH   r4   r   r   rh   r   <  ri   r   rh   c                       e Zd Zd Zy)-Test_queryAdapter.test_named_hit.<locals>.Bazc                     || _         y r   rK   r\   s     r   r]   z6Test_queryAdapter.test_named_hit.<locals>.Baz.__init__A  r^   r   Nr_   r4   r   r   r   r   ?  ra   r   r   r   r   r   s
             r   r   z Test_queryAdapter.test_named_hit4  r   r   c                 N   ddl m} ddl m} ddlm} ddlm} ddlm}  G d d|      } G d	 d
|      } ||       G d dt                     } ||       G d dt                     }	 ||       G d dt                     }
 G d d|      } |       }|j                  ||f|d        |d|f      }|j                  |	|f|d        |
       }| j                  ||d ||            }| j                  |j                  |	u        | j                  |j                  |u        y )Nr   r/   rP   rR   r1   r!   c                       e Zd Zy)+Test_queryAdapter.test_nested.<locals>.IFooNrH   r4   r   r   rI   r  O  rJ   r   rI   c                       e Zd Zy)+Test_queryAdapter.test_nested.<locals>.IBarNrH   r4   r   r   rX   r  Q  rJ   r   rX   c                       e Zd Zd Zy)-Test_queryAdapter.test_nested.<locals>.Globalc                     || _         y r   rK   r\   s     r   r]   z6Test_queryAdapter.test_nested.<locals>.Global.__init__U  r^   r   Nr_   r4   r   r   r`   r  S  ra   r   r`   c                       e Zd Zd Zy),Test_queryAdapter.test_nested.<locals>.Localc                     || _         y r   rK   r\   s     r   r]   z5Test_queryAdapter.test_nested.<locals>.Local.__init__Y  r^   r   Nr_   r4   r   r   re   r	  W  ra   r   re   c                       e Zd Zy)*Test_queryAdapter.test_nested.<locals>.BarNrH   r4   r   r   rh   r  [  ri   r   rh   c                       e Zd Zd Zy).Test_queryAdapter.test_nested.<locals>.Contextc                     || _         y r   rm   rn   s     r   r]   z7Test_queryAdapter.test_nested.<locals>.Context.__init___  ro   r   Nr_   r4   r   r   rp   r  ^  rq   r   rp   r7   rr   rs   rK   ru   rx   s                   r   test_nestedzTest_queryAdapter.test_nestedI  s%   ,.67L	9 		9 		T		'V 	' 
	' 
T		'F 	' 
	' 
T		& 	 
		&0 	& #$FTGT26sg.ED7D"5e--T2ws|-D))U233./r   N)r<   r=   r>   r?   r   r   r   r   r   r   r   r  r4   r   r   r   r   
  s$    6)&E0*0*0r   r   c                   @    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zy	)
Test_getMultiAdapterr   r   c                     ddl m}  ||i |S )Nr   )getMultiAdapter)rD   r  )r   r   r   r  s       r   r   zTest_getMultiAdapter._callFUTo      2+++r   c                     ddl m} ddlm}  G d d|      }| j	                  || j
                  t               t               f|d       y )Nr   r/   r)   c                       e Zd Zy):Test_getMultiAdapter.test_anonymous_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r  v  rJ   r   rI   r7   rL   rM   s       r   r   z,Test_getMultiAdapter.test_anonymous_nonesuchs  s<    ,B	9 	.--&(FH)=tR	Ir   c                     ddl m} ddlm}  G d d|      }| j	                  || j
                  t               t               f|d       y )Nr   r/   r)   c                       e Zd Zy)6Test_getMultiAdapter.test_named_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r  ~  rJ   r   rI   ry   rL   rM   s       r   r   z(Test_getMultiAdapter.test_named_nonesuch{  s<    ,B	9 	.--&(FH)=tU	Lr   c                 0   ddl m} ddl m} ddlm}  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } ||       G d dt
                     }	 |       j                  |	||f|d        |       }
 |       }| j                  |
|f|d      }| j                  |j                  |	u        | j                  |j                  |
u        | j                  |j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)5Test_getMultiAdapter.test_anonymous_hit.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   c                       e Zd Zy)5Test_getMultiAdapter.test_anonymous_hit.<locals>.IBarNrH   r4   r   r   rX   r     rJ   r   rX   c                       e Zd Zy)5Test_getMultiAdapter.test_anonymous_hit.<locals>.IBazNrH   r4   r   r   IBazr"    rJ   r   r#  c                       e Zd Zy)4Test_getMultiAdapter.test_anonymous_hit.<locals>.BarNrH   r4   r   r   rh   r%    ri   r   rh   c                       e Zd Zy)4Test_getMultiAdapter.test_anonymous_hit.<locals>.BazNrH   r4   r   r   r   r'    ri   r   r   c                       e Zd Zd Zy);Test_getMultiAdapter.test_anonymous_hit.<locals>.FooAdapterc                 "    ||c| _         | _        y r   firstsecondr   r,  r-  s      r   r]   zDTest_getMultiAdapter.test_anonymous_hit.<locals>.FooAdapter.__init__      */'
DKr   Nr_   r4   r   r   
FooAdapterr)        8r   r0  r7   r8   r0   rQ   rD   r2   r$   r9   r   r   rw   r,  r-  r   r0   rQ   r2   rI   rX   r#  rh   r   r0  ry   bazrz   s                r   r   z'Test_getMultiAdapter.test_anonymous_hit  s   ,.7	9 		9 		9 		T		& 	 
		T		& 	 
		T		8 	8 
	8 	.. *T4L$	Dee--c
D"5))Z78,-#-.r   c                    ddl m} ddl m} ddlm}  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } |       j                  ||d f|d        |       }	t               }
| j                  |	|
f|d      }| j                  |j                  |u        | j                  |j                  |	u        | j                  |j                  |
u        y )Nr   r/   rP   r1   c                       e Zd Zy)ITest_getMultiAdapter.test_anonymous_hit_registered_for_None.<locals>.IFooNrH   r4   r   r   rI   r7    rJ   r   rI   c                       e Zd Zy)ITest_getMultiAdapter.test_anonymous_hit_registered_for_None.<locals>.IBarNrH   r4   r   r   rX   r9    rJ   r   rX   c                       e Zd Zy)ITest_getMultiAdapter.test_anonymous_hit_registered_for_None.<locals>.IBazNrH   r4   r   r   r#  r;    rJ   r   r#  c                       e Zd Zy)HTest_getMultiAdapter.test_anonymous_hit_registered_for_None.<locals>.BarNrH   r4   r   r   rh   r=    ri   r   rh   c                       e Zd Zd Zy)OTest_getMultiAdapter.test_anonymous_hit_registered_for_None.<locals>.FooAdapterc                 "    ||c| _         | _        y r   r+  r.  s      r   r]   zXTest_getMultiAdapter.test_anonymous_hit_registered_for_None.<locals>.FooAdapter.__init__  r/  r   Nr_   r4   r   r   r0  r?    r1  r   r0  r7   r2  )r   r0   rQ   r2   rI   rX   r#  rh   r0  ry   r4  rz   s               r   r   z;Test_getMultiAdapter.test_anonymous_hit_registered_for_None  s    ,.7	9 		9 		9 		T		& 	 
		T		8 	8 
	8 	.. *T4L$	Deh--c
D"5))Z78,-#-.r   c                 0   ddl m} ddl m} ddlm}  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } ||       G d dt
                     }	 |       j                  |	||f|d        |       }
 |       }| j                  |
|f|d      }| j                  |j                  |	u        | j                  |j                  |
u        | j                  |j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)1Test_getMultiAdapter.test_named_hit.<locals>.IFooNrH   r4   r   r   rI   rC    rJ   r   rI   c                       e Zd Zy)1Test_getMultiAdapter.test_named_hit.<locals>.IBarNrH   r4   r   r   rX   rE    rJ   r   rX   c                       e Zd Zy)1Test_getMultiAdapter.test_named_hit.<locals>.IBazNrH   r4   r   r   r#  rG    rJ   r   r#  c                       e Zd Zy)0Test_getMultiAdapter.test_named_hit.<locals>.BarNrH   r4   r   r   rh   rI    ri   r   rh   c                       e Zd Zy)0Test_getMultiAdapter.test_named_hit.<locals>.BazNrH   r4   r   r   r   rK    ri   r   r   c                       e Zd Zd Zy)7Test_getMultiAdapter.test_named_hit.<locals>.FooAdapterc                 "    ||c| _         | _        y r   r+  r.  s      r   r]   z@Test_getMultiAdapter.test_named_hit.<locals>.FooAdapter.__init__  r/  r   Nr_   r4   r   r   r0  rM    r1  r   r0  r   r2  r3  s                r   r   z#Test_getMultiAdapter.test_named_hit     ,.7	9 		9 		9 		T		& 	 
		T		& 	 
		T		8 	8 
	8 	..$.tdG	Mee--c
D':))Z78,-#-.r   Nr   r4   r   r   r  r  k  s%    6,IL/:/4/r   r  c                   F    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zd	 Zy
)Test_queryMultiAdapterr   r   c                     ddl m}  ||i |S )Nr   )queryMultiAdapter)rD   rS  )r   r   r   rS  s       r   r   zTest_queryMultiAdapter._callFUT  s    4 $-"--r   c                     ddl m}  G d d|      }| j                  | j                  t	               t	               f|dd      d       y )Nr   r/   c                       e Zd Zy)<Test_queryMultiAdapter.test_anonymous_nonesuch.<locals>.IFooNrH   r4   r   r   rI   rV    rJ   r   rI   r7   r   r   r   s      r   r   z.Test_queryMultiAdapter.test_anonymous_nonesuch  s?    ,	9 	&(';T2,79$	&r   c                     ddl m}  G d d|      }| j                  | j                  t	               t	               f|d      d        y )Nr   r/   c                       e Zd Zy)8Test_queryMultiAdapter.test_named_nonesuch.<locals>.IFooNrH   r4   r   r   rI   rY    rJ   r   rI   ry   r   r   s      r   r   z*Test_queryMultiAdapter.test_named_nonesuch  s:    ,	9 	&(';T5I	r   c                 0   ddl m} ddl m} ddlm}  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } ||       G d dt
                     }	 |       j                  |	||f|d        |       }
 |       }| j                  |
|f|d      }| j                  |j                  |	u        | j                  |j                  |
u        | j                  |j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)7Test_queryMultiAdapter.test_anonymous_hit.<locals>.IFooNrH   r4   r   r   rI   r\    rJ   r   rI   c                       e Zd Zy)7Test_queryMultiAdapter.test_anonymous_hit.<locals>.IBarNrH   r4   r   r   rX   r^    rJ   r   rX   c                       e Zd Zy)7Test_queryMultiAdapter.test_anonymous_hit.<locals>.IBazNrH   r4   r   r   r#  r`    rJ   r   r#  c                       e Zd Zy)6Test_queryMultiAdapter.test_anonymous_hit.<locals>.BarNrH   r4   r   r   rh   rb    ri   r   rh   c                       e Zd Zy)6Test_queryMultiAdapter.test_anonymous_hit.<locals>.BazNrH   r4   r   r   r   rd    ri   r   r   c                       e Zd Zd Zy)=Test_queryMultiAdapter.test_anonymous_hit.<locals>.FooAdapterc                 "    ||c| _         | _        y r   r+  r.  s      r   r]   zFTest_queryMultiAdapter.test_anonymous_hit.<locals>.FooAdapter.__init__  r/  r   Nr_   r4   r   r   r0  rf    r1  r   r0  r7   r2  r3  s                r   r   z)Test_queryMultiAdapter.test_anonymous_hit  s   ,.7	9 		9 		9 		T		& 	 
		T		& 	 
		T		8 	8 
	8 	..$.tdB	Hee--c
D"5))Z78,-#-.r   c                 0   ddl m} ddl m} ddlm}  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } ||       G d dt
                     }	 |       j                  |	||f|d        |       }
 |       }| j                  |
|f|d      }| j                  |j                  |	u        | j                  |j                  |
u        | j                  |j                  |u        y )Nr   r/   rP   r1   c                       e Zd Zy)3Test_queryMultiAdapter.test_named_hit.<locals>.IFooNrH   r4   r   r   rI   rj    rJ   r   rI   c                       e Zd Zy)3Test_queryMultiAdapter.test_named_hit.<locals>.IBarNrH   r4   r   r   rX   rl    rJ   r   rX   c                       e Zd Zy)3Test_queryMultiAdapter.test_named_hit.<locals>.IBazNrH   r4   r   r   r#  rn    rJ   r   r#  c                       e Zd Zy)2Test_queryMultiAdapter.test_named_hit.<locals>.BarNrH   r4   r   r   rh   rp    ri   r   rh   c                       e Zd Zy)2Test_queryMultiAdapter.test_named_hit.<locals>.BazNrH   r4   r   r   r   rr    ri   r   r   c                       e Zd Zd Zy)9Test_queryMultiAdapter.test_named_hit.<locals>.FooAdapterc                 "    ||c| _         | _        y r   r+  r.  s      r   r]   zBTest_queryMultiAdapter.test_named_hit.<locals>.FooAdapter.__init__  r/  r   Nr_   r4   r   r   r0  rt    r1  r   r0  r   r2  r3  s                r   r   z%Test_queryMultiAdapter.test_named_hit  rO  r   c                    ddl m} ddl m} ddlm} ddlm} ddlm}  G d d|      } G d	 d
|      } G d d|      } ||       G d dt                     }	 ||       G d dt                     }
 ||       G d dt                     } ||       G d dt                     } G d d|      } |       }|j                  |||f|d        |d|f      }|j                  |||f|d        |	       } |
       }| j                  ||f|d ||            }| j                  |j                  |u        | j                  |j                  |u        | j                  |j                  |u        y )Nr   r/   rP   rR   r1   r!   c                       e Zd Zy)0Test_queryMultiAdapter.test_nested.<locals>.IFooNrH   r4   r   r   rI   rx  /  rJ   r   rI   c                       e Zd Zy)0Test_queryMultiAdapter.test_nested.<locals>.IBarNrH   r4   r   r   rX   rz  1  rJ   r   rX   c                       e Zd Zy)0Test_queryMultiAdapter.test_nested.<locals>.IBazNrH   r4   r   r   r#  r|  3  rJ   r   r#  c                       e Zd Zy)/Test_queryMultiAdapter.test_nested.<locals>.BarNrH   r4   r   r   rh   r~  5  ri   r   rh   c                       e Zd Zy)/Test_queryMultiAdapter.test_nested.<locals>.BazNrH   r4   r   r   r   r  8  ri   r   r   c                       e Zd Zd Zy)2Test_queryMultiAdapter.test_nested.<locals>.Globalc                 "    ||c| _         | _        y r   r+  r.  s      r   r]   z;Test_queryMultiAdapter.test_nested.<locals>.Global.__init__=  r/  r   Nr_   r4   r   r   r`   r  ;  r1  r   r`   c                       e Zd Zd Zy)1Test_queryMultiAdapter.test_nested.<locals>.Localc                 "    ||c| _         | _        y r   r+  r.  s      r   r]   z:Test_queryMultiAdapter.test_nested.<locals>.Local.__init__A  r/  r   Nr_   r4   r   r   re   r  ?  r1  r   re   c                       e Zd Zd Zy)3Test_queryMultiAdapter.test_nested.<locals>.Contextc                     || _         y r   rm   rn   s     r   r]   z<Test_queryMultiAdapter.test_nested.<locals>.Context.__init__D  ro   r   Nr_   r4   r   r   rp   r  C  rq   r   rp   r7   rr   rs   rK   )r8   r0   rQ   rv   rS   rD   r2   r#   r"   r$   r9   r   r   rw   r,  r-  )r   r0   rQ   rS   r2   r"   rI   rX   r#  rh   r   r`   re   rp   r:   rr   ry   r4  rz   s                      r   r  z"Test_queryMultiAdapter.test_nested)  sq   ,.67L	9 		9 		9 		T		& 	 
		T		& 	 
		T		8V 	8 
	8 
T		8F 	8 
	8	&0 	& #$FT4L$;sg.ED$<r:ee--c
D"gcl-K))U23,-#-.r   c                 p   ddl m} ddl m} ddlm  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } G fddt
              } |       }	 |       }
| j                  |	|
f|d |             }| j                  |d u        y )Nr   r/   rP   r)   c                       e Zd Zy)8Test_queryMultiAdapter.test_wo_sitemanager.<locals>.IFooNrH   r4   r   r   rI   r  U  rJ   r   rI   c                       e Zd Zy)8Test_queryMultiAdapter.test_wo_sitemanager.<locals>.IBarNrH   r4   r   r   rX   r  W  rJ   r   rX   c                       e Zd Zy)8Test_queryMultiAdapter.test_wo_sitemanager.<locals>.IBazNrH   r4   r   r   r#  r  Y  rJ   r   r#  c                       e Zd Zy)7Test_queryMultiAdapter.test_wo_sitemanager.<locals>.BarNrH   r4   r   r   rh   r  [  ri   r   rh   c                       e Zd Zy)7Test_queryMultiAdapter.test_wo_sitemanager.<locals>.BazNrH   r4   r   r   r   r  ^  ri   r   r   c                       e Zd Z fdZy);Test_queryMultiAdapter.test_wo_sitemanager.<locals>.Contextc                     r   r4   r   r   r*   s     r   r   zGTest_queryMultiAdapter.test_wo_sitemanager.<locals>.Context.__conform__b  	    **r   Nr   r)   s   r   rp   r  a      +r   rp   r7   rK   )r8   r0   rQ   r   r*   r$   r   r   r   r0   rQ   rI   rX   r#  rh   r   rp   ry   r4  rz   r*   s               @r   test_wo_sitemanagerz*Test_queryMultiAdapter.test_wo_sitemanagerQ  s    ,.B	9 		9 		9 		T		& 	 
		T		& 	 
		+f 	+ ee--c
D"gi-H4(r   N)r<   r=   r>   r?   r   r   r   r   r   r   r   r  r  r4   r   r   rQ  rQ    s)    6.&/:/:&/P)r   rQ  c                   4    e Zd ZddlmZmZ d Zd Zd Zd Z	y)Test_getAdaptersr   r   c                     ddl m}  ||i |S )Nr   )getAdapters)rD   r  )r   r   r   r  s       r   r   zTest_getAdapters._callFUTn      .D'B''r   c                     ddl m}  G d d|      }| j                  t        | j	                  t               f|            g        y )Nr   r/   c                       e Zd Zy),Test_getAdapters.test_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r  t  rJ   r   rI   )r8   r0   r   listr   r$   r   s      r   test_nonesuchzTest_getAdapters.test_nonesuchr  s5    ,	9 	dmmVXK>?Dr   c                    ddl m} ddlm}  G d d|      } G d dt              } G d d	t              } |       }|j                  |d
|       |j                  |d
|d       t        | j                  t	               f|            }| j                  t        |      d       |D 	cg c]  \  }}	||	j                  j                  f }
}}	| j                  d|
v        | j                  d|
v        y c c}	}w )Nr   r/   r1   c                       e Zd Zy)'Test_getAdapters.test_hit.<locals>.IFooNrH   r4   r   r   rI   r  {  rJ   r   rI   c                       e Zd Zd Zy)-Test_getAdapters.test_hit.<locals>.BarAdapterc                     || _         y r   rK   r\   s     r   r]   z6Test_getAdapters.test_hit.<locals>.BarAdapter.__init__~  r^   r   Nr_   r4   r   r   
BarAdapterr  }      'r   r  c                       e Zd Zd Zy)-Test_getAdapters.test_hit.<locals>.BazAdapterc                     || _         y r   rK   r\   s     r   r]   z6Test_getAdapters.test_hit.<locals>.BazAdapter.__init__  r^   r   Nr_   r4   r   r   
BazAdapterr    r  r   r  r   ry   name   )r7   r  )ry   r  )r8   r0   rD   r2   r$   r9   r  r   r   lenrw   r<   r   )r   r0   r2   rI   r  r  r:   tuplesr5   ynamess              r   test_hitzTest_getAdapters.test_hitx  s    ,7	9 		' 	'	' 	' #$J6JEBdmmVXK67Va(7=>tq!!Q[[))*>>*e34-67 ?s   )"C5c                 l   ddl m} ddl m} ddlm  G d d|      } G d d|      } G d	 d
|      } ||       G d dt
                     } ||       G d dt
                     } G fddt
              } |       }	 |       }
| j                  |	|
f| |             }| j                  |g        y )Nr   r/   rP   r)   c                       e Zd Zy)2Test_getAdapters.test_wo_sitemanager.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   c                       e Zd Zy)2Test_getAdapters.test_wo_sitemanager.<locals>.IBarNrH   r4   r   r   rX   r    rJ   r   rX   c                       e Zd Zy)2Test_getAdapters.test_wo_sitemanager.<locals>.IBazNrH   r4   r   r   r#  r    rJ   r   r#  c                       e Zd Zy)1Test_getAdapters.test_wo_sitemanager.<locals>.BarNrH   r4   r   r   rh   r    ri   r   rh   c                       e Zd Zy)1Test_getAdapters.test_wo_sitemanager.<locals>.BazNrH   r4   r   r   r   r    ri   r   r   c                       e Zd Z fdZy)5Test_getAdapters.test_wo_sitemanager.<locals>.Contextc                     r   r4   r  s     r   r   zATest_getAdapters.test_wo_sitemanager.<locals>.Context.__conform__  r  r   Nr   r)   s   r   rp   r    r  r   rp   rK   )r8   r0   rQ   r   r*   r$   r   r   r  s               @r   r  z$Test_getAdapters.test_wo_sitemanager  s    ,.B	9 		9 		9 		T		& 	 
		T		& 	 
		+f 	+ ee--c
D')-D"%r   N
r<   r=   r>   r?   r   r   r   r  r  r  r4   r   r   r  r  j  s    6(E8(&r   r  c                   4    e Zd ZddlmZmZ d Zd Zd Zd Z	y)Test_subscribersr   r   c                     ddl m}  ||i |S )Nr   )subscribers)rD   r  )r   r   r   r  s       r   r   zTest_subscribers._callFUT  r  r   c                 x    ddl m}  G d d|      }| j                  t        f|      }| j	                  |g        y )Nr   r/   c                       e Zd Zy),Test_subscribers.test_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   )r8   r0   r   r$   r   r   r0   rI   r  s       r   r  zTest_subscribers.test_nonesuch  s3    ,	9 	mmVIt4b)r   c                    ddl m} ddlm}  G d d|      } G d dt              } G d d	t              } |       }|j                  |d
|       |j                  |d
|       | j                  t	               f|      }| j                  t        |      d       |D cg c]  }|j                  j                   }	}| j                  d|	v        | j                  d	|	v        y c c}w )Nr   r/   r1   c                       e Zd Zy)'Test_subscribers.test_hit.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   c                       e Zd Zd Zy)-Test_subscribers.test_hit.<locals>.BarAdapterc                     || _         y r   rK   r\   s     r   r]   z6Test_subscribers.test_hit.<locals>.BarAdapter.__init__  r^   r   Nr_   r4   r   r   r  r    r  r   r  c                       e Zd Zd Zy)-Test_subscribers.test_hit.<locals>.BazAdapterc                     || _         y r   rK   r\   s     r   r]   z6Test_subscribers.test_hit.<locals>.BazAdapter.__init__  r^   r   Nr_   r4   r   r   r  r    r  r   r  r   r  )r8   r0   rD   r2   r$   registerSubscriptionAdapterr   r   r  rw   r<   r   )
r   r0   r2   rI   r  r  r:   r  r5   r  s
             r   r  zTest_subscribers.test_hit  s    ,7	9 		' 	'	' 	' #$''
GTB''
GTBmmVXK6[)1-1<=A!++&&==-.-. >s   C#c                     ddl m} ddlm  G d d|      } G fddt              }| j                  t        f| |             }| j                  |g        y )	Nr   r/   r)   c                       e Zd Zy)2Test_subscribers.test_wo_sitemanager.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   c                       e Zd Z fdZy)5Test_subscribers.test_wo_sitemanager.<locals>.Contextc                     r   r4   r  s     r   r   zATest_subscribers.test_wo_sitemanager.<locals>.Context.__conform__  r  r   Nr   r)   s   r   rp   r    r  r   rp   rK   )r8   r0   r   r*   r$   r   r   )r   r0   rI   rp   r  r*   s        @r   r  z$Test_subscribers.test_wo_sitemanager  sK    ,B	9 		+f 	+ mmVItWYmGb)r   Nr  r4   r   r   r  r    s    6(*/(	*r   r  c                   .    e Zd ZddlmZmZ d Zd Zd Zy)Test_handler   r   c                     ddl m}  ||i |S )Nr   )handle)rD   r  )r   r   r   r  s       r   r   zTest_handle._callFUT  s    )t"r""r   c                 T    ddl m}  G d d|      }| j                  t        f|      }y )Nr   r/   c                       e Zd Zy)'Test_handle.test_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   )r8   r0   r   r$   r  s       r   r  zTest_handle.test_nonesuch  s#    ,	9 	mmVIt4r   c                   	 ddl m} ddlm} ddlm}  G d d|      } ||       G d dt
                     }g 		fd	}	fd
} |       }|j                  ||f       |j                  ||f       | j                   |              | j                  t        	      d	       | j                  d	v        | j                  d	v        y )Nr   r1   r/   rP   c                       e Zd Zy)"Test_handle.test_hit.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   c                       e Zd Zy)!Test_handle.test_hit.<locals>.FooNrH   r4   r   r   r   r    ri   r   r   c                 (    j                  d       y )N_barappendr&   _calleds    r   r  z"Test_handle.test_hit.<locals>._bar      v&r   c                 (    j                  d       y )N_bazr  r  s    r   r  z"Test_handle.test_hit.<locals>._baz  r  r   r  r  r  )rD   r2   r8   r0   rQ   r$   registerHandlerr   r   r  r   )
r   r2   r0   rQ   rI   r   r  r  r:   r  s
            @r   r  zTest_handle.test_hit  s    7,.	9 		T		& 	 
		'	'"$D4'*D4'*ceWq'2')*')*r   N	r<   r=   r>   r?   r   r   r   r  r  r4   r   r   r  r    s    6#5+r   r  c                   @    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zy	)
Test_getUtilityr   r   c                     ddl m}  ||i |S )Nr   )
getUtility)r
   r  )r   r   r   r  s       r   r   zTest_getUtility._callFUT  s    24&2&&r   c                 l    ddl m} ddlm}  G d d|      }| j	                  || j
                  |       y )Nr   r/   r)   c                       e Zd Zy)5Test_getUtility.test_anonymous_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   r8   r0   r   r*   r+   r   rM   s       r   r   z'Test_getUtility.test_anonymous_nonesuch  s+    ,B	9 	.tDr   c                 p    ddl m} ddlm}  G d d|      }| j	                  || j
                  |d       y )Nr   r/   r)   c                       e Zd Zy)1Test_getUtility.test_named_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   ry   r  r   rM   s       r   r   z#Test_getUtility.test_named_nonesuch  s5    ,B	9 	.--E 	 	;r   c                     ddl m} ddlm}  G d d|      }t	               } |       j                  ||       | j                  | j                  |      |u        y )Nr   r/   r1   c                       e Zd Zy)0Test_getUtility.test_anonymous_hit.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   r8   r0   rD   r2   r$   registerUtilityr   r   r   r0   r2   rI   objs        r   r   z"Test_getUtility.test_anonymous_hit  H    ,7	9 	h..sD9d+s23r   c                     ddl m} ddlm}  G d d|      }t	               } |       j                  ||d       | j                  | j                  |d      |u        y )Nr   r/   r1   c                       e Zd Zy),Test_getUtility.test_named_hit.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   ry   r  r  r	  s        r   r   zTest_getUtility.test_named_hit  Q    ,7	9 	h..sDu.Ed73>?r   c                    ddl m} ddlm} ddlm}  G d dt              } G d d|      }t               }t               } ||      } ||      }	 |       j                  ||       | j                  | j                  ||		      |u        y )
Nr   r/   r1   r!   c                       e Zd Zd Zd Zy)5Test_getUtility.test_w_conforming_context.<locals>.SMc                     || _         y r   _objr   r
  s     r   r]   z>Test_getUtility.test_w_conforming_context.<locals>.SM.__init__'  	    	r   c                     | j                   S r   r  r   	interfacer  r   s       r   queryUtilityzBTest_getUtility.test_w_conforming_context.<locals>.SM.queryUtility)      yy r   Nr<   r=   r>   r]   r  r4   r   r   SMr  &       !r   r  c                       e Zd Zy)7Test_getUtility.test_w_conforming_context.<locals>.IFooNrH   r4   r   r   rI   r!  +  rJ   r   rI   rK   
r8   r0   rD   r2   r#   r"   r$   r  r   r   
r   r0   r2   r"   r  rI   obj1obj2r   r&   s
             r   test_w_conforming_contextz)Test_getUtility.test_w_conforming_context"  u    ,7L	! 	!
	9 	xxX,R0..tT:dG<DEr   N)r<   r=   r>   r?   r   r   r   r   r   r   r   r&  r4   r   r   r  r    s&    6'E;4@Fr   r  c                   L    e Zd ZddlmZmZ d Zd Zd Zd Z	d Z
d Zd	 Zd
 Zy)Test_queryUtilityr   r   c                     ddl m}  ||i |S )Nr   )r  )r
   r  )r   r   r   r  s       r   r   zTest_queryUtility._callFUT9  s    4T(R((r   c                 h    ddl m}  G d d|      }| j                  | j                  |      d        y )Nr   r/   c                       e Zd Zy)7Test_queryUtility.test_anonymous_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r-  ?  rJ   r   rI   r8   r0   r   r   r   s      r   r   z)Test_queryUtility.test_anonymous_nonesuch=  s*    ,	9 	t,d3r   c                     ddl m}  G d d|      }t               }| j                  | j	                  ||      |u        y )Nr   r/   c                       e Zd Zy)ATest_queryUtility.test_anonymous_nonesuch_w_default.<locals>.IFooNrH   r4   r   r   rI   r1  E  rJ   r   rI   )r   r8   r0   r$   r   r   r   r0   rI   r
  s       r   !test_anonymous_nonesuch_w_defaultz3Test_queryUtility.test_anonymous_nonesuch_w_defaultC  s6    ,	9 	hdC8C?@r   c                 l    ddl m}  G d d|      }| j                  | j                  |d      d        y )Nr   r/   c                       e Zd Zy)3Test_queryUtility.test_named_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r7  L  rJ   r   rI   ry   r  r.  r   s      r   r   z%Test_queryUtility.test_named_nonesuchJ  s.    ,	9 	t%8$?r   c                     ddl m}  G d d|      }t               }| j                  | j	                  |d|      |u        y )Nr   r/   c                       e Zd Zy)=Test_queryUtility.test_named_nonesuch_w_default.<locals>.IFooNrH   r4   r   r   rI   r:  R  rJ   r   rI   ry   )r  r   r2  r3  s       r   test_named_nonesuch_w_defaultz/Test_queryUtility.test_named_nonesuch_w_defaultP  s8    ,	9 	hdDKLr   c                     ddl m} ddlm}  G d d|      }t	               } |       j                  ||       | j                  | j                  |      |u        y )Nr   r/   r1   c                       e Zd Zy)2Test_queryUtility.test_anonymous_hit.<locals>.IFooNrH   r4   r   r   rI   r>  Z  rJ   r   rI   r  r	  s        r   r   z$Test_queryUtility.test_anonymous_hitW  r  r   c                     ddl m} ddlm}  G d d|      }t	               } |       j                  ||d       | j                  | j                  |d      |u        y )Nr   r/   r1   c                       e Zd Zy).Test_queryUtility.test_named_hit.<locals>.IFooNrH   r4   r   r   rI   rA  c  rJ   r   rI   ry   r  r  r	  s        r   r   z Test_queryUtility.test_named_hit`  r  r   c                    ddl m} ddlm} ddlm}  G d dt              } G d d|      }t               }t               } ||      } ||      }	 |       j                  ||       | j                  | j                  ||		      |u        y )
Nr   r/   r1   r!   c                       e Zd Zd Zd Zy)7Test_queryUtility.test_w_conforming_context.<locals>.SMc                     || _         y r   r  r  s     r   r]   z@Test_queryUtility.test_w_conforming_context.<locals>.SM.__init__n  r  r   c                     | j                   S r   r  r  s       r   r  zDTest_queryUtility.test_w_conforming_context.<locals>.SM.queryUtilityp  r  r   Nr  r4   r   r   r  rD  m  r  r   r  c                       e Zd Zy)9Test_queryUtility.test_w_conforming_context.<locals>.IFooNrH   r4   r   r   rI   rH  r  rJ   r   rI   rK   r"  r#  s
             r   r&  z+Test_queryUtility.test_w_conforming_contexti  r'  r   N)r<   r=   r>   r?   r   r   r   r   r4  r   r;  r   r   r&  r4   r   r   r)  r)  5  s2    6)4A@M4@Fr   r)  c                   .    e Zd ZddlmZmZ d Zd Zd Zy)Test_getUtilitiesForr   r   c                     ddl m}  ||i |S )Nr   )getUtilitiesFor)r
   rL  )r   r   r   rL  s       r   r   zTest_getUtilitiesFor._callFUT  s    7+++r   c                 z    ddl m}  G d d|      }| j                  t        | j	                  |            g        y )Nr   r/   c                       e Zd Zy)0Test_getUtilitiesFor.test_nonesuch.<locals>.IFooNrH   r4   r   r   rI   rO    rJ   r   rI   r8   r0   r   r  r   r   s      r   r  z"Test_getUtilitiesFor.test_nonesuch  /    ,	9 	dmmD12B7r   c                 x   ddl m} ddlm}  G d d|      }t	               }t	               } |       j                  ||        |       j                  ||d       t        | j                  |            }| j                  t        |      d       | j                  d	|f|v        | j                  d|f|v        y )
Nr   r/   r1   c                       e Zd Zy)+Test_getUtilitiesFor.test_hit.<locals>.IFooNrH   r4   r   r   rI   rT    rJ   r   rI   ry   r  r  r7   r8   r0   rD   r2   r$   r  r  r   r   r  r   )r   r0   r2   rI   r
  r$  r  s          r   r  zTest_getUtilitiesFor.test_hit  s    ,7	9 	hx..sD9..tT.FdmmD)*Va(S	V+,/0r   Nr  r4   r   r   rJ  rJ  |  s    6,81r   rJ  c                   .    e Zd ZddlmZmZ d Zd Zd Zy)!Test_getAllUtilitiesRegisteredForr   r   c                     ddl m}  ||i |S )Nr   )getAllUtilitiesRegisteredFor)rD   rY  )r   r   r   rY  s       r   r   z*Test_getAllUtilitiesRegisteredFor._callFUT  s    ?+T8R88r   c                 z    ddl m}  G d d|      }| j                  t        | j	                  |            g        y )Nr   r/   c                       e Zd Zy)=Test_getAllUtilitiesRegisteredFor.test_nonesuch.<locals>.IFooNrH   r4   r   r   rI   r\    rJ   r   rI   rP  r   s      r   r  z/Test_getAllUtilitiesRegisteredFor.test_nonesuch  rQ  r   c                    ddl m} ddlm}  G d d|      } G d d|      }t	               }t	               }t	               } |       j                  ||        |       j                  ||d	        |       j                  ||       t        | j                  |            }| j                  t        |      d
       | j                  ||v        | j                  ||v        | j                  ||v        y )Nr   r/   r1   c                       e Zd Zy)8Test_getAllUtilitiesRegisteredFor.test_hit.<locals>.IFooNrH   r4   r   r   rI   r_    rJ   r   rI   c                       e Zd Zy)8Test_getAllUtilitiesRegisteredFor.test_hit.<locals>.IBarNrH   r4   r   r   rX   ra    rJ   r   rX   ry   r     rU  )	r   r0   r2   rI   rX   r
  r$  r%  utss	            r   r  z*Test_getAllUtilitiesRegisteredFor.test_hit  s    ,7	9 		4 	hxx..sD9..tT.F..tT:4==&'S1%s
#$$r   Nr  r4   r   r   rW  rW    s    698%r   rW  c                   .    e Zd ZddlmZmZ d Zd Zd Zy)Test_getNextUtilityr   r   c                     ddl m}  ||i |S )Nr   )getNextUtility)rD   rg  )r   r   r   rg  s       r   r   zTest_getNextUtility._callFUT  s    1t*r**r   c                     ddl m} ddlm}  |       }t	        d|      }|j                  |t        d       | j                  || j                  |t        d       y )Nr   r1   r)   globalmyutil)	rD   r2   zope.component.interfacer*   _makeMyUtilityr  
IMyUtilityr+   r   )r   r2   r*   r:   gutils        r   test_globalzTest_getNextUtility.test_global  sM    7A"$x-E:x8.--
H	Fr   c                 8   ddl m} ddlm} ddlm}  |       }t        d|      }|j                  |t        d        |d|f      } |d	|f      }t        d
|      }|j                  |t        d       | j                   ||      |u        | j                  | j                  |t        d      |u        t        d|      }	|j                  |	t        d       | j                   ||	      |u        | j                  | j                  |	t        d      |u        y )Nr   r1   r   rR   ri  rj  rr   rs   sm1_1oneone-one)rD   r2   r   r   rv   rS   rl  r  rm  r   r   )
r   r2   r   rS   r:   rn  rr   rq  util1util1_1s
             r   r  zTest_getNextUtility.test_nested  s    7>6"$x-E:x8sg.73'2uc*E:x8(/367eZBeKL E2gz8<(1U:;gz8DMNr   N)	r<   r=   r>   r?   r   r   r   ro  r  r4   r   r   re  re    s    6+FOr   re  c                   4    e Zd ZddlmZmZ d Zd Zd Zd Z	y)Test_queryNextUtilityr   r   c                     ddl m}  ||i |S )Nr   )queryNextUtility)rD   ry  )r   r   r   ry  s       r   r   zTest_queryNextUtility._callFUT  s    3,,,r   c                     ddl m}  |       }t        d|      }|j                  |t        d       | j                  | j                  |t        d      d        y )Nr   r1   ri  rj  )rD   r2   rl  r  rm  r   r   )r   r2   r:   rn  s       r   ro  z!Test_queryNextUtility.test_global  sH    7"$x-E:x8uj(CTJr   c                 F   ddl m} ddlm}  |       }t	        d|      }|j                  |t        d        |d|f      } |d|f      }t	        d	|      }|j                  |t        d       t	        d
|      }|j                  |t        d        |       }	t	        d|	      }
|	j                  |
t        d       |	f|j                  z   |_        | j                  | j                  |t        d      |
u        | j                  | j                  |t        d      |u        y )Nr   r1   rR   ri  rj  rr   rs   rq  rr  rs  my_custom_util)
rD   r2   rv   rS   rl  r  rm  	__bases__r   r   )r   r2   rS   r:   rn  rr   rq  rt  ru  
myregistrycustom_utils              r   r  z!Test_queryNextUtility.test_nested  s   76"$x-E:x8sg.73'2uc*E:x8 E2gz8<\
$%5zB"";
<LM#5c:7GH/:; 	<c:x@EIJr   c                     ddl m} ddlm  G d d|      } G fddt              }| j                  | j                   |       |d      d        y )	Nr   r/   r)   c                       e Zd Zy)7Test_queryNextUtility.test_wo_sitemanager.<locals>.IFooNrH   r4   r   r   rI   r    rJ   r   rI   c                       e Zd Z fdZy):Test_queryNextUtility.test_wo_sitemanager.<locals>.Contextc                     r   r4   r  s     r   r   zFTest_queryNextUtility.test_wo_sitemanager.<locals>.Context.__conform__	  r  r   Nr   r)   s   r   rp   r    r  r   rp   rj  )r8   r0   r   r*   r$   r   r   )r   r0   rI   rp   r*   s       @r   r  z)Test_queryNextUtility.test_wo_sitemanager  sB    ,B	9 		+f 	+ 	wy$A4Hr   N)
r<   r=   r>   r?   r   r   r   ro  r  r  r4   r   r   rw  rw    s    6-KK*Ir   rw  c                   .    e Zd ZddlmZmZ d Zd Zd Zy)Test_createObjectr   r   c                     ddl m}  ||i |S )Nr   )createObject)rD   r  )r   r   r   r  s       r   r   zTest_createObject._callFUT  r   r   c                 J    ddl m} | j                  || j                  d       y Nr   r)   nonesuchr   r*   r+   r   r,   s     r   rN   zTest_createObject.test_miss      B.zJr   c                     ddl m t               g fd G fddt              } |       }| j                  | j	                  d|      u        | j                  di fg       y )	Nr   IFactoryc                  .    j                  | |f       S r   r  )r   r   _factory_called_objects     r   _factoryz,Test_createObject.test_hit.<locals>._factory  s    ""D":.Nr   c                        e Zd Zd Z fdZy)+Test_createObject.test_hit.<locals>.Contextc                     | S r   r4   r   r   s     r   r   z7Test_createObject.test_hit.<locals>.Context.__conform__"      r   c                     |u r|dk(  rS |S Ntestr4   )r   r   r  r   r  r  s       r   r  z8Test_createObject.test_hit.<locals>.Context.queryUtility$  s    H$#Or   Nr<   r=   r>   r   r  r  r  s   r   rp   r  !      r   rp   r  rK   r4   )r   r  r$   r   r   r   )r   rp   r&   r  r  r  r  s      @@@@r   r  zTest_createObject.test_hit  s`    6(		f 	 )fg>'IJB8*5r   N	r<   r=   r>   r?   r   r   r   rN   r  r4   r   r   r  r    s    6)K6r   r  c                   .    e Zd ZddlmZmZ d Zd Zd Zy)Test_getFactoryInterfacesr   r   c                     ddl m}  ||i |S )Nr   )getFactoryInterfaces)rD   r  )r   r   r   r  s       r   r   z"Test_getFactoryInterfaces._callFUT1  s    7#T0R00r   c                 J    ddl m} | j                  || j                  d       y r  r  r,   s     r   rN   z#Test_getFactoryInterfaces.test_miss5  r  r   c                     ddl m ddlm}  G d d|       G fddt               G fdd	t              } |       }| j                  | j                  d
|      g       y )Nr   r  r/   c                       e Zd Zy)0Test_getFactoryInterfaces.test_hit.<locals>.IFooNrH   r4   r   r   rI   r  <  rJ   r   rI   c                       e Zd Z fdZy)4Test_getFactoryInterfaces.test_hit.<locals>._Factoryc                 
    gS r   r4   )r   rI   s    r   getInterfaceszBTest_getFactoryInterfaces.test_hit.<locals>._Factory.getInterfaces?  s
    vr   Nr<   r=   r>   r  )rI   s   r   _Factoryr  >  s    r   r  c                        e Zd Zd Z fdZy)3Test_getFactoryInterfaces.test_hit.<locals>.Contextc                     | S r   r4   r  s     r   r   z?Test_getFactoryInterfaces.test_hit.<locals>.Context.__conform__B  r  r   c                 (    |u r|dk(  r        S |S r  r4   )r   r   r  r   r  r  s       r   r  z@Test_getFactoryInterfaces.test_hit.<locals>.Context.queryUtilityD  s    H$#:%r   Nr  )r  r  s   r   rp   r  A  r  r   rp   r  rK   )r   r  r8   r0   r$   r   r   )r   r0   rp   r&   r  rI   r  s       @@@r   r  z"Test_getFactoryInterfaces.test_hit9  sU    6,	9 		v 		f 	 )vw?$Hr   Nr  r4   r   r   r  r  -  s    61KIr   r  c                   4    e Zd ZddlmZmZ d Zd Zd Zd Z	y)Test_getFactoriesForr   r   c                     ddl m}  ||i |S )Nr   )getFactoriesFor)rD   r  )r   r   r   r  s       r   r   zTest_getFactoriesFor._callFUTP  r  r   c                 z    ddl m}  G d d|      }| j                  t        | j	                  |            g        y )Nr   r/   c                       e Zd Zy)?Test_getFactoriesFor.test_no_factories_registered.<locals>.IFooNrH   r4   r   r   rI   r  V  rJ   r   rI   rP  r   s      r   test_no_factories_registeredz1Test_getFactoriesFor.test_no_factories_registeredT  rQ  r   c           	        	 ddl m} ddl m} ddl m	 ddlm  G d d|      } G d d	|      } |||       G 	fd
dt                     } |        G fddt              }| j                  t        | j                  | |                   dfg       | j                  t        | j                  | |                   dfg       y )Nr   r/   rP   r   r  c                       e Zd Zy)@Test_getFactoriesFor.test_w_factory_returning_spec.<locals>.IFooNrH   r4   r   r   rI   r  _  rJ   r   rI   c                       e Zd Zy)@Test_getFactoriesFor.test_w_factory_returning_spec.<locals>.IBarNrH   r4   r   r   rX   r  a  rJ   r   rX   c                       e Zd Z fdZy)DTest_getFactoriesFor.test_w_factory_returning_spec.<locals>._Factoryc                      |       S r   r4   )r   r   s    r   r  zRTest_getFactoriesFor.test_w_factory_returning_spec.<locals>._Factory.getInterfacese  s    !$''r   Nr  r  s   r   r  r  c  s    (r   r  c                        e Zd Zd Z fdZy)CTest_getFactoriesFor.test_w_factory_returning_spec.<locals>.Contextc                     | S r   r4   r  s     r   r   zOTest_getFactoriesFor.test_w_factory_returning_spec.<locals>.Context.__conform__i  r  r   c                     |u rdfgS y r  r4   r   r   r  r  s     r   rL  zSTest_getFactoriesFor.test_w_factory_returning_spec.<locals>.Context.getUtilitiesFork      H$#X.// %r   Nr<   r=   r>   r   rL  r  s   r   rp   r  h      0r   rp   rK   r  )
r8   r0   rQ   r   r   r  r$   r   r  r   )
r   r0   rQ   rI   rX   r  rp   r  r  r   s
          @@@r   test_w_factory_returning_specz2Test_getFactoriesFor.test_w_factory_returning_specZ  s    ,.-6	9 		9 		T4	 	(v 	( 
!	( :	0f 	0 	dmmD')mDE!8,-	/dmmD')mDE!8,-	/r   c           	      v   ddl m} ddlm  G d d|       G d d|       G fdd	t              } |        G fd
dt              }| j                  t        | j                   |                   dfg       | j                  t        | j                   |                   dfg       y )Nr   r/   r  c                       e Zd Zy)NTest_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>.IFooNrH   r4   r   r   rI   r  v  rJ   r   rI   c                       e Zd Zy)NTest_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>.IBarNrH   r4   r   r   rX   r  x  rJ   r   rX   c                       e Zd Z fdZy)RTest_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>._Factoryc                     gS r   r4   )r   rX   rI   s    r   r  z`Test_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>._Factory.getInterfaces{  s    d|#r   Nr  )rX   rI   s   r   r  r  z  s    $r   r  c                        e Zd Zd Z fdZy)QTest_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>.Contextc                     | S r   r4   r  s     r   r   z]Test_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>.Context.__conform__  r  r   c                     |u rdfgS y r  r4   r  s     r   rL  zaTest_getFactoriesFor.test_w_factory_returning_list_of_interfaces.<locals>.Context.getUtilitiesFor  r  r   Nr  r  s   r   rp   r  ~  r  r   rp   rK   r  )r8   r0   r   r  r$   r   r  r   )r   r0   r  rp   rX   r  rI   r  s       @@@@r   +test_w_factory_returning_list_of_interfacesz@Test_getFactoriesFor.test_w_factory_returning_list_of_interfacess  s    ,6	9 		9 		$v 	$ :	0f 	0 	dmmD')mDE!8,-	/dmmD')mDE!8,-	/r   N)
r<   r=   r>   r?   r   r   r   r  r  r  r4   r   r   r  r  L  s    6,8/2/r   r  c                     ddl m} ddl m} ddlm} t
         G d d|      a |t
               G d d|             } || |      S )	Nr   r/   rP   r!   c                       e Zd Zy)rm  NrH   r4   r   r   rm  rm    rJ   r   rm  c                       e Zd Zd Zy)!_makeMyUtility.<locals>.MyUtilityc                      || _         || _        y r   )idr%   )r   r  r   s      r   r]   z*_makeMyUtility.<locals>.MyUtility.__init__  s    DG!Dr   Nr_   r4   r   r   	MyUtilityr    s    	"r   r  )r8   r0   rQ   r#   r"   rm  )r  r   r0   rQ   r"   r  s         r   rl  rl    sM    (*H	 	 ". " "
 T2r   c                     t        j                  t        j                  t              t        j                  t              t        j                  t
              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t              t        j                  t               t        j                  t"              t        j                  t$              t        j                  t&              t        j                  t(              t        j                  t*              f      S r   )unittest	TestSuite	makeSuiter   rA   r}   r   r   r  rQ  r  r  r  r  r)  rJ  rW  re  rw  r  r  r  r4   r   r   
test_suiter    s4   ./3456?+,-/012+,+,;'?+,-/0<=./01,-45/0'  r   )__doc__r  TestCaser   rA   r}   r   r   r  rQ  r  r  r  r  r)  rJ  rW  re  rw  r  r  r  rm  rl  r  r4   r   r   <module>r     s   )7(++ )7X/0x00 /0dCG!2!2 CGLP0h'' P0f^0)) ^0Bj/8,, j/ZO)X.. O)d8&x(( 8&v,*x(( ,*^"+(## "+J9Fh'' 9FxDF)) DFN18,, 1:%(9(9 %D!O(++ !OH,IH-- ,I^6)) 6>I 1 1 I>;/8,, ;/| 
&r   