
    e                       d Z ddlZddlmZ ddlmZ ddlmZ  G d dej                        Z	 G d d	e	      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      Z G d de      Z G d dee      Z G d dee      Z G d dej                        Z G d de      Z G d de      Z G d  d!      Zy)"zComponent Registry Tests    N	Interface)VerifyingAdapterRegistry
Componentsc                       e Zd Zd Zdsd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d 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d 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*d) Z+d* Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdD ZFdE ZG fdFZH fdGZIdH ZJdI ZKdJ ZLdK ZMdL ZNdM ZO fdNZPdO ZQdP ZRdQ ZSdR ZTdS ZUdT ZVdU ZWdV ZXdW ZYdX ZZdY Z[dZ Z\d[ Z]d\ Z^d] Z_d^ Z`d_ Zad` Zbda Zcdb Zddc Zedd Zfde Zgdf Zhdg Zidh Zjdi Zkdj Zldk Zmdl Zndm Zodn Zpdo ZqdtdpZrdq Zsdr Zt xZuS )uComponentsTestsc                     t         S Nr   selfs    D/usr/lib/python3/dist-packages/zope/interface/tests/test_registry.py_getTargetClasszComponentsTests._getTargetClass   s        c                 6     | j                         |g|i |S r   r   )r   nameargskws       r   _makeOnezComponentsTests._makeOne   s"    %t##%d8T8R88r   c                 @    ddl m} g fd}t        ||      }|fS )Nr   )registryc                  ,    j                  | |f       y r   append)r   r   _eventss     r   _notifyz,ComponentsTests._wrapEvents.<locals>._notify"   s    NND":&r   )notify)zope.interfacer   _Monkey)r   r   r   _monkeyr   s       @r   _wrapEventszComponentsTests._wrapEvents   s'    +	'(73r   c                    ddl m} | j                  d      }| j                  |j                  d       | j                  |j
                  d       | j                  t        |j                  |             | j                  t        |j                  |             | j                  |j                  j
                  d       | j                  |j                  j
                  d       | j                  |j                  i        | j                  |j                  i        | j                  |j                  g        | j                  |j                  g        y )Nr   )AdapterRegistrytesting )zope.interface.adapterr$   r   assertEqual__name__	__bases__
assertTrue
isinstanceadapters	utilities_utility_registrations_adapter_registrations_subscription_registrations_handler_registrations)r   r$   comps      r   test_ctor_no_basesz"ComponentsTests.test_ctor_no_bases'   s    :}}Y'	2,
4==/BC
4>>?CD00"5112644b944b9992>44b9r   c                    | j                  d      }| j                  d|f      }| j                  |j                  d       | j                  |j                  |f       | j                  |j                  j                  |j                  f       | j                  |j
                  j                  |j
                  f       y )Nbaser%   )r   r(   r)   r*   r-   r.   )r   r6   r3   s      r   test_ctor_w_basez ComponentsTests.test_ctor_w_base5   s    }}V$}}Y0	2$1004==2BC11DNN3DEr   c                 \    | j                  d      }| j                  t        |      d       y )Nr%   z<Components testing>r   r(   reprr   r3   s     r   test___repr__zComponentsTests.test___repr__=   s%    }}Y'd%;<r   c                    | j                  d      }| j                  d      }| j                         }||f|_        | j                  |j                  ||f       | j                  |j                  j                  |j                  |j                  f       | j                  |j                  j                  |j                  |j                  f       y )Nbase1base2)r   r*   r(   r-   r.   )r   r>   r?   r3   s       r   test_assign_to___bases__z(ComponentsTests.test_assign_to___bases__C   s    g&g&}}%800..%..9	;11//5??;	=r   c                    ddl m}m}  G d d|      } |d      } |d       G d d             } |       }d}| j                         }|j	                  |||	       | j                  |j                  |df   ||d f       y )
Nr   namedInterfaceClassc                       e Zd Zy)FComponentsTests.test_registerUtility_with_component_name.<locals>.IFooNr)   
__module____qualname__r&   r   r   IFoorF   R       r   rJ   fooc                       e Zd Zy)EComponentsTests.test_registerUtility_with_component_name.<locals>.FooNrG   r&   r   r   FoorN   V       r   rO   inforQ   )zope.interface.declarationsrC   rD   r   registerUtilityr(   r/   )	r   rC   rD   rJ   ifoorO   rL   _infor3   s	            r   (test_registerUtility_with_component_namez8ComponentsTests.test_registerUtility_with_component_nameN   s    E	> 	F|	u	 	 
	e}}S$U3''e4%	 r   c                     d }t               }| j                         }| j                  t        |j                  ||       y )Nc                      t               r   NotImplementedErrorr&   r   r   _factoryzQComponentsTests.test_registerUtility_both_factory_and_component.<locals>._factoryc       %''r   	componentfactory)objectr   assertRaises	TypeErrorrT   r   r\   _to_regr3   s       r   /test_registerUtility_both_factory_and_componentz?ComponentsTests.test_registerUtility_both_factory_and_componentb   s;    	((}})T%9%9$+X 	 	?r   c                    ddl m} ddlm} ddlm}  G d d|      } |d      }d}d}t               }| j                         }	| j                         \  }
}|
5  |	j                  ||||       d d d        | j                  |	j                  j                  d   |   |   |u        | j                  |	j                  ||f   ||d f       | j                  |	j                  j                  d   |   d	   |f       | j                  t!        |      d
       |d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j                  |             | j                  |j                  j$                  |	u        | j                  |j                  j&                  |u        | j                  |j                  j(                  |u        | j                  |j                  j*                  |u        | j                  |j                  j,                  |u        | j                  |j                  j.                  d u        y # 1 sw Y   xY w)Nr   rD   
RegisteredUtilityRegistrationc                       e Zd Zy)>ComponentsTests.test_registerUtility_w_component.<locals>.IFooNrG   r&   r   r   rJ   rn   o   rK   r   rJ   rQ   r       )rS   rD   zope.interface.interfacesrj   zope.interface.registryrl   ra   r   r"   rT   r+   r.   	_adaptersr(   r/   _subscriberslenr,   r   providedr   r_   rQ   r`   )r   rD   rj   rl   rJ   rU   rV   _namere   r3   r!   r   r   r   events                  r    test_registerUtility_w_componentz0ComponentsTests.test_registerUtility_w_componentj   s   >8?	> 	F|(}}++- 	>  $u=	>003D9%@GKL44T5[A!5$/	144Q7=bAG:NWq)1:bR 
5*56
5<<1DEF--56--56))U23..'9:))U23,,45#	> 	>s   II(c                    ddl m} ddlm} ddlm}  G d d|      } |d      }d}d}t               fd	}| j                         }	| j                         \  }
}|
5  |	j                  d ||||
       d d d        | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |	u        | j                  |j                  j                  |u        | j                  |j                  j                   |u        | j                  |j                  j"                  u        | j                  |j                  j$                  |u        | j                  |j                  j&                  |u        y # 1 sw Y   nxY w)Nr   rh   ri   rk   c                       e Zd Zy)<ComponentsTests.test_registerUtility_w_factory.<locals>.IFooNrG   r&   r   r   rJ   r|      rK   r   rJ   rQ   r   c                       S r   r&   re   s   r   r\   z@ComponentsTests.test_registerUtility_w_factory.<locals>._factory       Nr   r`   rp   )rS   rD   rq   rj   rr   rl   ra   r   r"   rT   r(   ru   r+   r,   r   rv   r   r_   rQ   r`   )r   rD   rj   rl   rJ   rU   rV   rw   r\   r3   r!   r   r   r   rx   re   s                  @r   test_registerUtility_w_factoryz.ComponentsTests.test_registerUtility_w_factory   s   >8?	> 	F|(	}}++- 	M  tUE8 L	MWq)1:bR 
5*56
5<<1DEF--56--56))U23..'9:))U23,,89	M 	Ms   G""G,c                      G d d      }d}d} |       }| j                         }| j                  t        |j                  |d ||       y )Nc                       e Zd Zy)GComponentsTests.test_registerUtility_no_provided_available.<locals>.FooNrG   r&   r   r   rO   r      rK   r   rO   rQ   r   )r   rb   rc   rT   )r   rO   rV   rw   re   r3   s         r   *test_registerUtility_no_provided_availablez:ComponentsTests.test_registerUtility_no_provided_available   sL    	 	 %}})..ue	Mr   c                    ddl m} ddl m} ddlm} ddlm}  G d d|      } G d d	      } |d      }d
}d}	 |       }
 ||
|       | j                         }| j                         \  }}|5  |j                  |
d |	|       d d d        | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |u        | j                  |j                  j"                  |	u        | j                  |j                  j$                  |
u        | j                  |j                  j&                  |u        | j                  |j                  j(                  d u        y # 1 sw Y   nxY w)Nr   directlyProvidesrh   ri   rk   c                       e Zd Zy)>ComponentsTests.test_registerUtility_wo_provided.<locals>.IFooNrG   r&   r   r   rJ   r      rK   r   rJ   c                       e Zd Zy)=ComponentsTests.test_registerUtility_wo_provided.<locals>.FooNrG   r&   r   r   rO   r      rK   r   rO   rQ   r   rp   )rS   r   rD   rq   rj   rr   rl   r   r"   rT   r(   ru   r+   r,   ra   r   rv   r   r_   rQ   r`   )r   r   rD   rj   rl   rJ   rO   rU   rV   rw   re   r3   r!   r   r   r   rx   s                    r    test_registerUtility_wo_providedz0ComponentsTests.test_registerUtility_wo_provided   s   @>8?	> 		 	F|%$'}}++- 	>  $u=	>Wq)1:bR 
5*56
5<<1DEF--56--56))U23..'9:))U23,,45	> 	>s   /G00G:c                 L   ddl m}  G d d|      } |d      }d}d}t               }| j                         }|j	                  ||||       | j                         \  }}	|5  |j	                  ||||       d d d        | j                  t        |	      d       y # 1 sw Y   %xY w)Nr   rh   c                       e Zd Zy)JComponentsTests.test_registerUtility_duplicates_existing_reg.<locals>.IFooNrG   r&   r   r   rJ   r      rK   r   rJ   rQ   r   )rS   rD   ra   r   rT   r"   r(   ru   
r   rD   rJ   rU   rV   rw   re   r3   r!   r   s
             r   ,test_registerUtility_duplicates_existing_regz<ComponentsTests.test_registerUtility_duplicates_existing_reg   s    >	> 	F|(}}WdE59++- 	>  $u=	>Wq)	> 	>s   !BB#c                    ddl m}  G d d|      } |d      }d}d}d}t               }| j                         }|j	                  ||||       | j                         \  }	}
|	5  |j	                  ||||       d d d        | j                  t        |
      d       | j                  |j                  ||f   ||d f       | j                  |j                  j                  d   |   d	   |f       y # 1 sw Y   yxY w)
Nr   rh   c                       e Zd Zy)CComponentsTests.test_registerUtility_w_different_info.<locals>.IFooNrG   r&   r   r   rJ   r      rK   r   rJ   info1info2r      ro   rS   rD   ra   r   rT   r"   r(   ru   r/   r.   rt   )r   rD   rJ   rU   _info1_info2rw   re   r3   r!   r   s              r   %test_registerUtility_w_different_infoz5ComponentsTests.test_registerUtility_w_different_info   s    >	> 	F|(}}WdE6:++- 	?  $v>	?Wq)44dE]C!640	244Q7=bA!	%	? 	?s   #C00C9c                 V   ddl m}  G d d|      } |d      }d}d}d}t               }t               }| j                         }	|	j	                  ||||       | j                         \  }
}|
5  |	j	                  ||||       d d d        | j                  t        |      d       | j                  |	j                  ||f   ||d f       | j                  |	j                  ||f   ||d f       | j                  |	j                  j                  d   |   d	   ||f       y # 1 sw Y   xY w)
Nr   rh   c                       e Zd Zy)SComponentsTests.test_registerUtility_w_different_names_same_component.<locals>.IFooNrG   r&   r   r   rJ   r      rK   r   rJ   rQ   name1name2rp   ro   r   r   rD   rJ   rU   rV   _name1_name2
_other_regre   r3   r!   r   s               r   5test_registerUtility_w_different_names_same_componentzEComponentsTests.test_registerUtility_w_different_names_same_component   s,   >	> 	F|X
(}}Zvu=++- 	?  $>	?Wq)44dF^D$eT2	444dF^D!5$/	144Q7=bA$g/	1	? 	?s   -DD(c                    ddl m} ddlm} ddlm} ddlm}  G d d|      } |d      }d}d	}t               t               }
}	| j                         }|j                  |	|||       | j                         \  }}|5  |j                  |
|||       d d d        | j                  t        |      d
       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |u        | j                  |j                  j"                  |u        | j                  |j                  j$                  |	u        | j                  |j                  j&                  |u        | j                  |j                  j(                  d u        |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |u        | j                  |j                  j"                  |u        | j                  |j                  j$                  |
u        | j                  |j                  j&                  |u        | j                  |j                  j(                  d u        y # 1 sw Y   xY w)Nr   rh   Unregisteredri   rk   c                       e Zd Zy)HComponentsTests.test_registerUtility_replaces_existing_reg.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   rQ   r   r   rp   )rS   rD   rq   r   rj   rr   rl   ra   r   rT   r"   r(   ru   r+   r,   r   rv   r   r_   rQ   r`   )r   rD   r   rj   rl   rJ   rU   rV   rw   _before_afterr3   r!   r   r   r   rx   s                    r   *test_registerUtility_replaces_existing_regz:ComponentsTests.test_registerUtility_replaces_existing_reg  s   >:8?	> 	F| (FH}}WdE59++- 	=  ue<	=Wq)1:bR 
5,78
5<<1DEF--56--56))U23..'9:))U23,,451:bR 
5*56
5<<1DEF--56--56))U23..&89))U23,,451	= 	=s   =MMc                 z   ddl m}  G d d|      } |d      }d}d}d}t               }| j                         }|j	                  ||||       | j                         \  }	}
|	5  |j	                  ||||       d d d        | j                  |j                  j                  d   |   d   |f       y # 1 sw Y   :xY w)	Nr   rh   c                       e Zd Zy)DComponentsTests.test_registerUtility_w_existing_subscr.<locals>.IFooNrG   r&   r   r   rJ   r   <  rK   r   rJ   rQ   r   r   ro   )	rS   rD   ra   r   rT   r"   r(   r.   rt   r   rD   rJ   rU   rV   r   r   re   r3   r!   r   s              r   &test_registerUtility_w_existing_subscrz6ComponentsTests.test_registerUtility_w_existing_subscr9  s    >	> 	F|(}}WdFE:++- 	?  $>	?44Q7=bAG:N	? 	?s   #B11B:c                 &   ddl m}  G d d|      } |d      }d}d}t               }| j                         }| j	                         \  }}	|5  |j                  ||||d       d d d        | j                  t        |	      d       y # 1 sw Y   %xY w)Nr   rh   c                       e Zd Zy);ComponentsTests.test_registerUtility_wo_event.<locals>.IFooNrG   r&   r   r   rJ   r   M  rK   r   rJ   rQ   r   F)rS   rD   ra   r   r"   rT   r(   ru   r   s
             r   test_registerUtility_wo_eventz-ComponentsTests.test_registerUtility_wo_eventJ  s    >	> 	F|(}}++- 	E  $ueD	EWq)	E 	Es   BBc                     G d d| j                               } |       }|j                  t               t               | j	                  t        t        |j                                     d        G d dt              }|j                  t               |       | j	                  t        t        |j                                     d       y )Nc                   "     e Zd ZdZ fdZ xZS )dComponentsTests.test_registerUtility_changes_object_identity_after.<locals>.CompThatChangesAfter1Regr   c                     | xj                   dz  c_         t        |   |  | j                   dk(  rt        | j                        | _        y y )Nrp   )	reg_countsuperrT   dictr/   r   r   	__class__s     r   rT   ztComponentsTests.test_registerUtility_changes_object_identity_after.<locals>.CompThatChangesAfter1Reg.registerUtility^  sB    !#'.>>Q&26t7R7R2SD/ 'r   r)   rH   rI   r   rT   __classcell__r   s   @r   CompThatChangesAfter1Regr   \  s    IT Tr   r   rp   c                       e Zd Zy)PComponentsTests.test_registerUtility_changes_object_identity_after.<locals>.IFooNrG   r&   r   r   rJ   r   i  rK   r   rJ   r   r   rT   ra   r   r(   ru   listregisteredUtilities)r   r   r3   rJ   s       r   2test_registerUtility_changes_object_identity_afterzBComponentsTests.test_registerUtility_changes_object_identity_afterY  s    	Tt';';'= 	T ()VXy1T$":":"<=>B	9 	 	VXt,T$":":"<=>Br   c                 P    G d d| j                               } |       }|j                  t               t               | j	                  t        t        |j                                     d        G d dt              }|j                  t               |       | j	                  t        t        |j                                     d        G d dt              }|j                  t               |       | j	                  t        t        |j                                     d	       y )
Nc                   "     e Zd ZdZ fdZ xZS )eComponentsTests.test_registerUtility_changes_object_identity_before.<locals>.CompThatChangesAfter2Regr   c                     | xj                   dz  c_         | j                   dk(  rt        | j                        | _        t        |   |  y )Nrp   r   )r   r   r/   r   rT   r   s     r   rT   zuComponentsTests.test_registerUtility_changes_object_identity_before.<locals>.CompThatChangesAfter2Reg.registerUtilityt  s=    !#>>Q&26t7R7R2SD/'.r   r   r   s   @r   CompThatChangesAfter2Regr   r  s    I/ /r   r   rp   c                       e Zd Zy)QComponentsTests.test_registerUtility_changes_object_identity_before.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   r   c                       e Zd Zy)QComponentsTests.test_registerUtility_changes_object_identity_before.<locals>.IBarNrG   r&   r   r   IBarr     rK   r   r      r   )r   r   r3   rJ   r   s        r   3test_registerUtility_changes_object_identity_beforezCComponentsTests.test_registerUtility_changes_object_identity_beforeo  s    	/t';';'= 	/ ()VXy1T$":":"<=>B	9 	 	VXt,T$":":"<=>B	9 	 	VXt,T$":":"<=>Br   c                 l    | j                         }| j                  t        |j                  d d d        y )N)r_   rv   r`   )r   rb   rc   unregisterUtilityr;   s     r   Atest_unregisterUtility_neither_factory_nor_component_nor_providedzQComponentsTests.test_unregisterUtility_neither_factory_nor_component_nor_provided  s2    }})T%;%;$(4 	 	Gr   c                     d }t               }| j                         }| j                  t        |j                  ||       y )Nc                      t               r   rZ   r&   r   r   r\   zSComponentsTests.test_unregisterUtility_both_factory_and_component.<locals>._factory  r]   r   r^   )ra   r   rb   rc   r   rd   s       r   1test_unregisterUtility_both_factory_and_componentzAComponentsTests.test_unregisterUtility_both_factory_and_component  s;    	((}})T%;%;$+X 	 	?r   c                 ,   ddl m}  G d d|      } |d      }d}t               }| j                         }| j	                         \  }}|5  |j                  |||      }	d d d        | j                  	       | j                  |       y # 1 sw Y   ,xY w)Nr   rh   c                       e Zd Zy)EComponentsTests.test_unregisterUtility_w_component_miss.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   r   )rS   rD   ra   r   r"   r   assertFalse)
r   rD   rJ   rU   rw   re   r3   r!   r   unregs
             r   'test_unregisterUtility_w_component_missz7ComponentsTests.test_unregisterUtility_w_component_miss  s    >	> 	F|(}}++- 	A**7D%@E	A!	A 	As   B

Bc                    ddl m} ddlm} ddlm}  G d d|      } |d      }d}t               }| j                         }|j                  |||       | j                         \  }	}
|	5  |j                  |||      }d d d        | j                         | j                  |j                  j                         | j                  ||f|j                  v        | j                  |j                  j                          | j#                  t%        |
      d       |
d   \  }}|\  }| j#                  |i        | j                  t'        ||             | j                  t'        |j                  |             | j                  |j                  j(                  |u        | j                  |j                  j*                  |u        | j                  |j                  j,                  |u        | j                  |j                  j.                  |u        | j                  |j                  j0                  d u        y # 1 sw Y   xY w)	Nr   rh   r   rk   c                       e Zd Zy)@ComponentsTests.test_unregisterUtility_w_component.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   r   rp   )rS   rD   rq   r   rr   rl   ra   r   rT   r"   r   r+   r   r.   rs   r/   rt   r(   ru   r,   r   rv   r   r_   r`   )r   rD   r   rl   rJ   rU   rw   re   r3   r!   r   r   r   r   rx   s                  r   "test_unregisterUtility_w_componentz2ComponentsTests.test_unregisterUtility_w_component  s   >:?	> 	F|(}}WdE2++- 	A**7D%@E	A112$$*E*EEF445Wq)1:bR 
5,78
5<<1DEF--56--56))U23..'9:,,45!	A 	As   *H==Ic                    ddl m} ddlm} ddlm}  G d d|      } |d      }d}d}t               fd	}| j                         }	|	j                  d ||||
       | j                         \  }
}|
5  |	j                  d |||
      }d d d        | j                         | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |	u        | j                  |j                  j                   |u        | j                  |j                  j"                  |u        | j                  |j                  j$                  u        | j                  |j                  j&                  |u        y # 1 sw Y   XxY w)Nr   rh   r   rk   c                       e Zd Zy)>ComponentsTests.test_unregisterUtility_w_factory.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   rQ   r   c                       S r   r&   r~   s   r   r\   zBComponentsTests.test_unregisterUtility_w_factory.<locals>._factory  r   r   r   rp   )rS   rD   rq   r   rr   rl   ra   r   rT   r"   r   r+   r(   ru   r,   r   rv   r   r_   r`   )r   rD   r   rl   rJ   rU   rV   rw   r\   r3   r!   r   r   r   r   rx   re   s                   @r    test_unregisterUtility_w_factoryz0ComponentsTests.test_unregisterUtility_w_factory  s   >:?	> 	F|(	}}T4xH++- 	P**4uh*OE	PWq)1:bR 
5,78
5<<1DEF--56--56))U23..'9:,,89	P 	Ps   5G!!G+c                 B   ddl m} ddl m} ddlm} ddlm}  G d d|      } G d d	      } |d      }d
}d}	 |       }
 ||
|       | j                         }|j                  |
||	|       | j                         \  }}|5  |j                  |
d |	      }d d d        | j                         | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                   |u        | j                  |j                  j"                  |u        | j                  |j                  j$                  |	u        | j                  |j                  j&                  |
u        | j                  |j                  j(                  |u        | j                  |j                  j*                  d u        y # 1 sw Y   xY w)Nr   r   rh   r   rk   c                       e Zd Zy)IComponentsTests.test_unregisterUtility_wo_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   c                       e Zd Zy)HComponentsTests.test_unregisterUtility_wo_explicit_provided.<locals>.FooNrG   r&   r   r   rO   r     rK   r   rO   rQ   r   rp   rS   r   rD   rq   r   rr   rl   r   rT   r"   r   r+   r(   ru   r,   ra   r   rv   r   r_   rQ   r`   r   r   rD   r   rl   rJ   rO   rU   rV   rw   re   r3   r!   r   r   r   r   rx   s                     r   +test_unregisterUtility_wo_explicit_providedz;ComponentsTests.test_unregisterUtility_wo_explicit_provided  s   @>:?	> 		 	F|%$'}}WdE59++- 	A**7D%@E	AWq)1:bR 
5,78
5<<1DEF--56--56))U23..'9:))U23,,45	A 	A   HHc                 B   ddl m} ddl m} ddlm} ddlm}  G d d|      } G d d	      } |d      }d
}d}	 |       }
 ||
|       | j                         }|j                  |
||	|       | j                         \  }}|5  |j                  ||	      }d d d        | j                         | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                   |u        | j                  |j                  j"                  |u        | j                  |j                  j$                  |	u        | j                  |j                  j&                  |
u        | j                  |j                  j(                  |u        | j                  |j                  j*                  d u        y # 1 sw Y   xY w)Nr   r   rh   r   rk   c                       e Zd Zy)LComponentsTests.test_unregisterUtility_wo_component_or_factory.<locals>.IFooNrG   r&   r   r   rJ   r     rK   r   rJ   c                       e Zd Zy)KComponentsTests.test_unregisterUtility_wo_component_or_factory.<locals>.FooNrG   r&   r   r   rO   r     rK   r   rO   rQ   r   rv   r   rp   r   r   s                     r   .test_unregisterUtility_wo_component_or_factoryz>ComponentsTests.test_unregisterUtility_wo_component_or_factory
  s   @>:?	> 		 	F|%$'}}WdE59++- 	F**Du*EE	F 	Wq)1:bR 
5,78
5<<1DEF--56--56))U23..'9:))U23,,45	F 	Fr   c                    ddl m}  G d d|      } |d      }d}d}d}t               }| j                         }|j	                  ||||       |j	                  ||||       | j                         \  }	}
|	5  |j                  |||       d d d        | j                  |j                  j                  d   |   d   |f       y # 1 sw Y   :xY w)	Nr   rh   c                       e Zd Zy)FComponentsTests.test_unregisterUtility_w_existing_subscr.<locals>.IFooNrG   r&   r   r   rJ   r   0  rK   r   rJ   rQ   r   r   ro   
rS   rD   ra   r   rT   r"   r   r(   r.   rt   r   s              r   (test_unregisterUtility_w_existing_subscrz8ComponentsTests.test_unregisterUtility_w_existing_subscr-  s    >	> 	F|(}}WdFE:WdFE:++- 	:""7D&9	:44Q7=bAG:N	: 	:   7CCc                    ddl m}  G d d|      } |d      }d}d}d}t               }| j                         }|j	                  ||||       |j	                  ||||       | j                         \  }	}
|	5  |j                  |||       d d d        | j                  |j                  j                  d   |   d   |f       y # 1 sw Y   :xY w)	Nr   rh   c                       e Zd Zy)SComponentsTests.test_unregisterUtility_w_existing_subscr_non_hashable.<locals>.IFooNrG   r&   r   r   rJ   r  B  rK   r   rJ   rQ   r   r   ro   )
rS   rD   r   r   rT   r"   r   r(   r.   rt   r   s              r   5test_unregisterUtility_w_existing_subscr_non_hashablezEComponentsTests.test_unregisterUtility_w_existing_subscr_non_hashable?  s    >	> 	F|&}}WdFE:WdFE:++- 	:""7D&9	:44Q7=bAG:N	: 	:r  c                    ddl m} ddlm}  G d d|      } |d      }d}d}d}t	               }| j                         }	|	j                  ||||       |	j                  ||||       | j                         \  }
}|
5  |	j                  |||       d d d        | j                  |	j                  j                  d   |   d	   |f       y # 1 sw Y   :xY w)
Nr   rh   )_UtilityRegistrationsc                       e Zd Zy)_ComponentsTests.test_unregisterUtility_w_existing_subscr_non_hashable_fresh_cache.<locals>.IFooNrG   r&   r   r   rJ   r	  W  rK   r   rJ   rQ   r   r   ro   )rS   rD   rr   r  r   r   rT   r"   r   r(   r.   rt   )r   rD   r  rJ   rU   rV   r   r   re   r3   r!   r   s               r   Atest_unregisterUtility_w_existing_subscr_non_hashable_fresh_cachezQComponentsTests.test_unregisterUtility_w_existing_subscr_non_hashable_fresh_cacheQ  s     	?A	> 	F|&}}WdFE:WdFE:++- 	:""7D&9	:44Q7=bAG:N	: 	:s   =C

Cc                    ddl m}  G d d|      } |d      }d}d}d}t               }| j                         }|j	                  ||||       |j	                  ||||       |j                  d       |j	                  ||||       | j                         \  }	}
|	5  |j                  |||       d d d        | j                  dt        |j                  j                               y # 1 sw Y   9xY w)	Nr   rh   c                       e Zd Zy)]ComponentsTests.test_unregisterUtility_w_existing_subscr_non_hashable_reinitted.<locals>.IFooNrG   r&   r   r   rJ   r  l  rK   r   rJ   rQ   r   r   r6   )rS   rD   r   r   rT   __init__r"   r   r(   ru   r.   rt   r   s              r   ?test_unregisterUtility_w_existing_subscr_non_hashable_reinittedzOComponentsTests.test_unregisterUtility_w_existing_subscr_non_hashable_reinittedg  s     	?	> 	F|&}}WdFE:WdFE: 	fWdFE:++- 	:""7D&9	: 	C ; ;<=	: 	:s   C((C1c                    ddl m}  G d d|      } |d      }d}d}d}t               }t               }| j                         }	|	j	                  ||||       |	j	                  ||||       | j                         \  }
}|
5  |	j                  |||       d d d        | j                  |	j                  j                  d   |   d   |f       y # 1 sw Y   :xY w)	Nr   rh   c                       e Zd Zy)VComponentsTests.test_unregisterUtility_w_existing_subscr_other_component.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   rQ   r   r   ro   r   r   s               r   8test_unregisterUtility_w_existing_subscr_other_componentzHComponentsTests.test_unregisterUtility_w_existing_subscr_other_component  s    >	> 	F|X
(}}Zvu=WdFE:++- 	:""7D&9	:44Q7=bA$	(	: 	:   CCc                    ddl m}  G d d|      } |d      }d}d}d}t               }t               }| j	                         }	|	j                  ||||       |	j                  ||||       | j                         \  }
}|
5  |	j                  |||       d d d        | j                  |	j                  j                  d   |   d   |f       y # 1 sw Y   :xY w)	Nr   rh   c                       e Zd Zy)aComponentsTests.test_unregisterUtility_w_existing_subscr_other_component_mixed_hash.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   rQ   r   r   ro   )rS   rD   ra   r   r   rT   r"   r   r(   r.   rt   r   s               r   Ctest_unregisterUtility_w_existing_subscr_other_component_mixed_hashzSComponentsTests.test_unregisterUtility_w_existing_subscr_other_component_mixed_hash  s    >	> 	F|X
&}}Zvu=WdFE:++- 	:""7D&9	:44Q7=bA$	(	: 	:r  c                 v    | j                         }| j                  t        |j                               g        y r   )r   r(   r   r   r;   s     r   test_registeredUtilities_emptyz.ComponentsTests.test_registeredUtilities_empty  s+    }}d66892>r   c                    ddl m} ddlm}  G d d|      } |d      }d}d}d}t	               }| j                         }	|	j                  ||||       |	j                  ||||       t        |	j                         d	 
      }
| j                  t        |
      d       | j                  t        |
d   |             | j                  |
d   j                  |	u        | j                  |
d   j                  |u        | j                  |
d   j                  |u        | j                  |
d   j                   |u        | j                  |
d   j"                  |u        | j                  |
d   j$                  d u        | j                  t        |
d   |             | j                  |
d   j                  |	u        | j                  |
d   j                  |u        | j                  |
d   j                  |u        | j                  |
d   j                   |u        | j                  |
d   j"                  |u        | j                  |
d   j$                  d u        y )Nr   rh   rk   c                       e Zd Zy)?ComponentsTests.test_registeredUtilities_notempty.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   rQ   r   r   c                     | j                   S r   r   rs    r   <lambda>zCComponentsTests.test_registeredUtilities_notempty.<locals>.<lambda>  s
    qvv r   keyr   rp   )rS   rD   rr   rl   ra   r   rT   sortedr   r(   ru   r+   r,   r   rv   r   r_   rQ   r`   )r   rD   rl   rJ   rU   rV   r   r   re   r3   regs              r   !test_registeredUtilities_notemptyz1ComponentsTests.test_registeredUtilities_notempty  s   >?	> 	F|(}}WdFE:WdFE:T--/5EFS1%
3q6+>?@A4/0A4/0Av-.A((G34Au,-A$./
3q6+>?@A4/0A4/0Av-.A((G34Au,-A$./r   c                     ddl m}  G d d|      } |d      }| j                         }| j                  |j	                  |      d u        y )Nr   rh   c                       e Zd Zy)?ComponentsTests.test_queryUtility_miss_no_default.<locals>.IFooNrG   r&   r   r   rJ   r*    rK   r   rJ   )rS   rD   r   r+   queryUtilityr   rD   rJ   rU   r3   s        r   !test_queryUtility_miss_no_defaultz1ComponentsTests.test_queryUtility_miss_no_default  sA    >	> 	F|}}))$/478r   c                     ddl m}  G d d|      } |d      }| j                         }t               }| j	                  |j                  ||      |u        y )Nr   rh   c                       e Zd Zy)>ComponentsTests.test_queryUtility_miss_w_default.<locals>.IFooNrG   r&   r   r   rJ   r0    rK   r   rJ   default)rS   rD   r   ra   r+   r+  )r   rD   rJ   rU   r3   _defaults         r    test_queryUtility_miss_w_defaultz0ComponentsTests.test_queryUtility_miss_w_default  sM    >	> 	F|}}8))$)AXMNr   c                     ddl m}  G d d|      } |d      }t               }| j                         }|j	                  ||       | j                  |j                  |      |u        y )Nr   rh   c                       e Zd Zy)3ComponentsTests.test_queryUtility_hit.<locals>.IFooNrG   r&   r   r   rJ   r7    rK   r   rJ   )rS   rD   ra   r   rT   r+   r+  r   rD   rJ   rU   re   r3   s         r   test_queryUtility_hitz%ComponentsTests.test_queryUtility_hit  sX    >	> 	F|(}}Wd+))$/7:;r   c                     ddl m} ddlm}  G d d|      } |d      }| j	                         }| j                  ||j                  |       y )Nr   rh   ComponentLookupErrorc                       e Zd Zy)2ComponentsTests.test_getUtility_miss.<locals>.IFooNrG   r&   r   r   rJ   r>    rK   r   rJ   )rS   rD   rq   r<  r   rb   
getUtility)r   rD   r<  rJ   rU   r3   s         r   test_getUtility_missz$ComponentsTests.test_getUtility_miss  s?    >B	> 	F|}}.Fr   c                     ddl m}  G d d|      } |d      }t               }| j                         }|j	                  ||       | j                  |j                  |      |u        y )Nr   rh   c                       e Zd Zy)1ComponentsTests.test_getUtility_hit.<locals>.IFooNrG   r&   r   r   rJ   rC    rK   r   rJ   )rS   rD   ra   r   rT   r+   r?  r8  s         r   test_getUtility_hitz#ComponentsTests.test_getUtility_hit  sV    >	> 	F|(}}Wd+-89r   c                     ddl m}  G d d|      } |d      }| j                         }| j                  t	        |j                  |            g        y )Nr   rh   c                       e Zd Zy)7ComponentsTests.test_getUtilitiesFor_miss.<locals>.IFooNrG   r&   r   r   rJ   rG    rK   r   rJ   )rS   rD   r   r(   r   getUtilitiesForr,  s        r   test_getUtilitiesFor_missz)ComponentsTests.test_getUtilitiesFor_miss  sE    >	> 	F|}}d224892>r   c                 "   ddl m}  G d d|      } |d      }d}d}t               }| j                         }|j	                  |||       |j	                  |||       | j                  t        |j                  |            ||f||fg       y )Nr   rh   c                       e Zd Zy)6ComponentsTests.test_getUtilitiesFor_hit.<locals>.IFooNrG   r&   r   r   rJ   rL    rK   r   rJ   r   r   r  )rS   rD   ra   r   rT   r(   r%  rH  r   rD   rJ   rU   r   r   re   r3   s           r   test_getUtilitiesFor_hitz(ComponentsTests.test_getUtilitiesFor_hit  s    >	> 	F|(}}Wd8Wd8 4 4T :;!7+fg->?	Ar   c                     ddl m}  G d d|      } |d      }| j                         }| j                  t	        |j                  |            g        y )Nr   rh   c                       e Zd Zy)DComponentsTests.test_getAllUtilitiesRegisteredFor_miss.<locals>.IFooNrG   r&   r   r   rJ   rQ    rK   r   rJ   )rS   rD   r   r(   r   getAllUtilitiesRegisteredForr,  s        r   &test_getAllUtilitiesRegisteredFor_missz6ComponentsTests.test_getAllUtilitiesRegisteredFor_miss  sE    >	> 	F|}}d??EFKr   c                    ddl m}  G d d|      } |d      }d}d}t               }| j                         }|j	                  |||       |j	                  |||       | j                  t        |j                  |            |g       y )Nr   rh   c                       e Zd Zy)CComponentsTests.test_getAllUtilitiesRegisteredFor_hit.<locals>.IFooNrG   r&   r   r   rJ   rV    rK   r   rJ   r   r   r  )rS   rD   ra   r   rT   r(   r   rR  rM  s           r   %test_getAllUtilitiesRegisteredFor_hitz5ComponentsTests.test_getAllUtilitiesRegisteredFor_hit  s    >	> 	F|(}}Wd8Wd8d??EF!	$r   c                    ddl m}m}  G d d|      } |d      } |d      } |d       G d d             }d	}| j                         }|j	                  ||f||
       | j                  |j                  |f|df   ||f       y )Nr   rB   c                       e Zd Zy)FComponentsTests.test_registerAdapter_with_component_name.<locals>.IFooNrG   r&   r   r   rJ   rZ  /  rK   r   rJ   r   rL   c                       e Zd Zy)EComponentsTests.test_registerAdapter_with_component_name.<locals>.FooNrG   r&   r   r   rO   r\  4  rP   r   rO   rQ   rR   )rS   rC   rD   r   registerAdapterr(   r0   )	r   rC   rD   rJ   rU   ibarrO   rV   r3   s	            r   (test_registerAdapter_with_component_namez8ComponentsTests.test_registerAdapter_with_component_name+  s    E	> 	F|F|	u	 	 
	}}S4'4e<''u(<=%L	r   c                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      }d}d	}d
 }	| j                         }
| j                         \  }}|5  |
j                  |	|f|||       d d d        | j                  |
j                  j                  d   |   |   |   |	u        | j                  |
j                  |f||f   |	|f       | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                   |             | j                  |j                   j"                  |
u        | j                  |j                   j$                  |u        | j                  |j                   j&                  |f       | j                  |j                   j(                  |u        | j                  |j                   j*                  |u        | j                  |j                   j,                  |	u        y # 1 sw Y   xY w)Nr   rh   ri   AdapterRegistrationc                       e Zd Zy)SComponentsTests.test_registerAdapter_w_explicit_provided_and_required.<locals>.IFooNrG   r&   r   r   rJ   rd  E  rK   r   rJ   r   rQ   r   c                     t               r   rZ   contexts    r   r\   zWComponentsTests.test_registerAdapter_w_explicit_provided_and_required.<locals>._factoryL  r]   r   rp   rS   rD   rq   rj   rr   rb  r   r"   r]  r+   r-   rs   r(   r0   ru   r,   ra   r   rv   requiredr   rQ   r`   )r   rD   rj   rb  rJ   rU   r^  rV   rw   r\   r3   r!   r   r   r   rx   s                   r   5test_registerAdapter_w_explicit_provided_and_requiredzEComponentsTests.test_registerAdapter_w_explicit_provided_and_required@  s   >8?	> 	F|F|	(}}++- 	H  D7D%G	H//248>uE#$ 	%44dWdE5IJ"E*	,Wq)1:bR 
5*56
5<<1DEF--56--56..8))U23))U23,,89#	H 	Hs   H55H?c                     ddl m}  G d d|      } |d      }d}d} G d d	      }| j                         }| j                  t        |j
                  ||f||
       y )Nr   rh   c                       e Zd Zy)HComponentsTests.test_registerAdapter_no_provided_available.<locals>.IFooNrG   r&   r   r   rJ   rm  f  rK   r   rJ   r   rQ   r   c                       e Zd Zy)LComponentsTests.test_registerAdapter_no_provided_available.<locals>._FactoryNrG   r&   r   r   _Factoryro  m  rK   r   rp  r   rQ   rS   rD   r   rb   rc   r]  )r   rD   rJ   r^  rV   rw   rp  r3   s           r   *test_registerAdapter_no_provided_availablez:ComponentsTests.test_registerAdapter_no_provided_availablec  se    >	> 	 F|	 	 }})T%9%98dW$5 	 	2r   c                    ddl m} ddl m} ddlm} ddlm}  G d d|      } |d      } |d      }d	}d
}	t               }
 ||       G d d             }| j                         }| j                         \  }}|5  |j                  ||f|	|       d d d        | j                  |j                  j                  d   |   |   |	   |u        | j                  |j                  |f||	f   ||f       | j                  t!        |      d       |d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j                  |             | j                  |j                  j$                  |u        | j                  |j                  j&                  |u        | j                  |j                  j(                  |f       | j                  |j                  j*                  |	u        | j                  |j                  j,                  |u        | j                  |j                  j.                  |u        y # 1 sw Y   xY w)Nr   rh   implementerri   ra  c                       e Zd Zy)GComponentsTests.test_registerAdapter_wo_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   rx  z  rK   r   rJ   r   rQ   r   c                       e Zd Zy)KComponentsTests.test_registerAdapter_wo_explicit_provided.<locals>._FactoryNrG   r&   r   r   rp  rz    rP   r   rp  rq  rp   )rS   rD   rv  rq   rj   rr   rb  ra   r   r"   r]  r+   r-   rs   r(   r0   ru   r,   r   rv   ri  r   rQ   r`   )r   rD   rv  rj   rb  rJ   rU   r^  rV   rw   re   rp  r3   r!   r   r   r   rx   s                     r   )test_registerAdapter_wo_explicit_providedz9ComponentsTests.test_registerAdapter_wo_explicit_providedt  s   >;8?	> 	F|F|(	T		 	 
	 }}++- 	L  D7U K	L//248>uE#$ 	%44dWdE5IJ"E*	,Wq)1:bR 
5*56
5<<1DEF--56--56..8))U23))U23,,89#	L 	Ls   <II!c                     ddl m}  G d d|      } |d      }d}d} G d d      }| j                         }| j                  t        |j
                  ||||	       y )
Nr   rh   c                       e Zd Zy)HComponentsTests.test_registerAdapter_no_required_available.<locals>.IFooNrG   r&   r   r   rJ   r~    rK   r   rJ   rQ   r   c                       e Zd Zy)LComponentsTests.test_registerAdapter_no_required_available.<locals>._FactoryNrG   r&   r   r   rp  r    s    r   rp  rv   r   rQ   rr  r   rD   rJ   rU   rV   rw   rp  r3   s           r   *test_registerAdapter_no_required_availablez:ComponentsTests.test_registerAdapter_no_required_available  sb    >	> 	F|	 	 }})T%9%98#'e% 	 	Ar   c           	          ddl m}  G d d|      } |d      } |d      }d}d} G d d	      }| j                         }| j                  t        |j
                  |||||
       y )Nr   rh   c                       e Zd Zy)EComponentsTests.test_registerAdapter_w_invalid_required.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   rQ   r   c                       e Zd Zy)IComponentsTests.test_registerAdapter_w_invalid_required.<locals>._FactoryNrG   r&   r   r   rp  r    rK   r   rp  r  rr  )	r   rD   rJ   rU   r^  rV   rw   rp  r3   s	            r   'test_registerAdapter_w_invalid_requiredz7ComponentsTests.test_registerAdapter_w_invalid_required  sk    >	> 	F|F|	 	}})T%9%98E 	 	Gr   c                    ddl m} ddlm} ddlm} ddlm}  G d d|      } |d      }d}d	} G d
 d      }	| j                         }
| j                         \  }}|5  |
j                  |	d g|||       d d d        | j                  |
j                  j                  d   |   |   |   |	u        | j                  |
j                  |f||f   |	|f       | j                  t!        |      d       |d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j$                  |             | j                  |j$                  j&                  |
u        | j                  |j$                  j(                  |u        | j                  |j$                  j*                  |f       | j                  |j$                  j,                  |u        | j                  |j$                  j.                  |u        | j                  |j$                  j0                  |	u        y # 1 sw Y   xY w)Nr   rh   r   ri   ra  c                       e Zd Zy)MComponentsTests.test_registerAdapter_w_required_containing_None.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   rQ   r   c                       e Zd Zy)QComponentsTests.test_registerAdapter_w_required_containing_None.<locals>._FactoryNrG   r&   r   r   rp  r    rK   r   rp  r  rp   )rS   rD   zope.interface.interfacer   rq   rj   rr   rb  r   r"   r]  r+   r-   rs   r(   r0   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   r   rj   rb  rJ   rU   rV   rw   rp  r3   r!   r   r   r   rx   s                   r   /test_registerAdapter_w_required_containing_Nonez?ComponentsTests.test_registerAdapter_w_required_containing_None  s   >68?	> 	F|	 	}}++- 	9  D6D&+% ! 9	9 	//29=dCEJ#$ 	%44i\45NO"E*	,Wq)1:bR 
5*56
5<<1DEF--56--56..=))U23))U23,,89%	9 	9s   H;;Ic                    ddl m} ddl m} ddl m} ddlm} ddlm}  G d d|      } |d      } |d	      }d
}	d}
 G d d      } ||       G d d             } ||      }| j                         }| j                         \  }}|5  |j                  ||g||
|	       d d d        | j                  |j                  j                  d   |   |   |
   |u        | j                  |j                  |f||
f   ||	f       | j                  t!        |      d       |d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j$                  |             | j                  |j$                  j&                  |u        | j                  |j$                  j(                  |u        | j                  |j$                  j*                  |f       | j                  |j$                  j,                  |
u        | j                  |j$                  j.                  |	u        | j                  |j$                  j0                  |u        y # 1 sw Y   xY w)Nr   rh   ru  )implementedByri   ra  c                       e Zd Zy)NComponentsTests.test_registerAdapter_w_required_containing_class.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   rQ   r   c                       e Zd Zy)RComponentsTests.test_registerAdapter_w_required_containing_class.<locals>._FactoryNrG   r&   r   r   rp  r    rK   r   rp  c                       e Zd Zy)RComponentsTests.test_registerAdapter_w_required_containing_class.<locals>._ContextNrG   r&   r   r   _Contextr    rP   r   r  r  rp   )rS   rD   rv  r  rq   rj   rr   rb  r   r"   r]  r+   r-   rs   r(   r0   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   rv  r  rj   rb  rJ   rU   r^  rV   rw   rp  r  	_ctx_implr3   r!   r   r   r   rx   s                       r   0test_registerAdapter_w_required_containing_classz@ComponentsTests.test_registerAdapter_w_required_containing_class  s)   >;=8?	> 	F|F|	 	 
T		 	 
	!(+	}}++- 	9  H:&+% ! 9	9 	//29=dCEJ#$ 	%44i\45NO"E*	,Wq)1:bR 
5*56
5<<1DEF--56--56..=))U23))U23,,89%	9 	9s   
I&&I0c           	          ddl m}  G d d|      } |d      }d}d} G d d      }| j                         }| j                  t        |j
                  |t               g|||	       y )
Nr   rh   c                       e Zd Zy)MComponentsTests.test_registerAdapter_w_required_containing_junk.<locals>.IFooNrG   r&   r   r   rJ   r  
  rK   r   rJ   rQ   r   c                       e Zd Zy)QComponentsTests.test_registerAdapter_w_required_containing_junk.<locals>._FactoryNrG   r&   r   r   rp  r    rK   r   rp  r  )rS   rD   r   rb   rc   r]  ra   r  s           r   /test_registerAdapter_w_required_containing_junkz?ComponentsTests.test_registerAdapter_w_required_containing_junk  sf    >	> 	F|	 	}})T%9%98fhZ#'e% 	 	Ar   c                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      d}d	} G fd
d      }| j                         }	| j                         \  }
}|
5  |	j                  ||||       d d d        | j                  |	j                  j                  d      |   |   |u        | j                  |	j                  f||f   ||f       | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                   |             | j                  |j                   j"                  |	u        | j                  |j                   j$                  |u        | j                  |j                   j&                  f       | j                  |j                   j(                  |u        | j                  |j                   j*                  |u        | j                  |j                   j,                  |u        y # 1 sw Y   xY w)Nr   rh   ri   ra  c                       e Zd Zy)GComponentsTests.test_registerAdapter_wo_explicit_required.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   rQ   r   c                       e Zd ZW  fZy)KComponentsTests.test_registerAdapter_wo_explicit_required.<locals>._FactoryNr)   rH   rI   __component_adapts__r^  s   r   rp  r  !      $(7 r   rp  r  rp   rh  )r   rD   rj   rb  rJ   rU   rV   rw   rp  r3   r!   r   r   r   rx   r^  s                  @r   )test_registerAdapter_wo_explicit_requiredz9ComponentsTests.test_registerAdapter_wo_explicit_required  s   >8?	> 	F|F|	+ 	+ }}++- 	-  Du&+ ! -	- 	//248>uE#$ 	%44dWdE5IJ"E*	,Wq)1:bR 
5*56
5<<1DEF--56--56..8))U23))U23,,89%	- 	-s   $H>>Ic           	      .   ddl m}  G d d|      } |d      } |d      }d}d}d }| j                         }| j                         \  }	}
|	5  |j	                  ||f|||d	
       d d d        | j                  t        |
      d       y # 1 sw Y   %xY w)Nr   rh   c                       e Zd Zy);ComponentsTests.test_registerAdapter_wo_event.<locals>.IFooNrG   r&   r   r   rJ   r  =  rK   r   rJ   r   rQ   r   c                     t               r   rZ   rf  s    r   r\   z?ComponentsTests.test_registerAdapter_wo_event.<locals>._factoryD  r]   r   F)rx   )rS   rD   r   r"   r]  r(   ru   )r   rD   rJ   rU   r^  rV   rw   r\   r3   r!   r   s              r   test_registerAdapter_wo_eventz-ComponentsTests.test_registerAdapter_wo_event:  s    >	> 	F|F|	(}}++- 	.  D7D%', ! .	. 	Wq)	. 	.s   BBc                 j    | j                         }| j                  t        |j                  d d        y N)r`   rv   )r   rb   rc   unregisterAdapterr;   s     r   3test_unregisterAdapter_neither_factory_nor_providedzCComponentsTests.test_unregisterAdapter_neither_factory_nor_providedM  s/    }})T%;%;"& 	 	7r   c                     ddl m}  G d d|      } |d      }| j                         }| j                  t        |j
                  d |d        y )Nr   rh   c                       e Zd Zy)QComponentsTests.test_unregisterAdapter_neither_factory_nor_required.<locals>.IFooNrG   r&   r   r   rJ   r  T  rK   r   rJ   r`   rv   ri  )rS   rD   r   rb   rc   r  r,  s        r   3test_unregisterAdapter_neither_factory_nor_requiredzCComponentsTests.test_unregisterAdapter_neither_factory_nor_requiredR  sJ    >	> 	F|}})T%;%;"& 	 	Fr   c                    ddl m}  G d d|      } |d      } |d      } G d d      }| j                         }| j                         \  }}|5  |j	                  ||f|      }	d d d        | j                  	       y # 1 sw Y   xY w)Nr   rh   c                       e Zd Zy)9ComponentsTests.test_unregisterAdapter_miss.<locals>.IFooNrG   r&   r   r   rJ   r  ]  rK   r   rJ   r   c                       e Zd Zy)=ComponentsTests.test_unregisterAdapter_miss.<locals>._FactoryNrG   r&   r   r   rp  r  a  rK   r   rp  )rS   rD   r   r"   r  r   
r   rD   rJ   rU   r^  rp  r3   r!   r   r   s
             r   test_unregisterAdapter_missz+ComponentsTests.test_unregisterAdapter_miss[  s    >	> 	F|F|	 	 }}++- 	D**8dWdCE	D	D 	Ds   B  B	c                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      } G d d	      }| j                         }|j                  ||f|       | j                         \  }	}
|	5  |j                  ||f|      }d d d        | j                         | j                  |j                  j                         | j                  |j                         | j                  t!        |
      d
       |
d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j$                  |             | j                  |j$                  j&                  |u        | j                  |j$                  j(                  |u        | j                  |j$                  j*                  |f       | j                  |j$                  j,                  d       | j                  |j$                  j.                  d       | j                  |j$                  j0                  |u        y # 1 sw Y   xY w)Nr   rh   r   ra  c                       e Zd Zy)YComponentsTests.test_unregisterAdapter_hit_w_explicit_provided_and_required.<locals>.IFooNrG   r&   r   r   rJ   r  n  rK   r   rJ   r   c                       e Zd Zy)]ComponentsTests.test_unregisterAdapter_hit_w_explicit_provided_and_required.<locals>._FactoryNrG   r&   r   r   rp  r  r  rK   r   rp  rp   ro   )rS   rD   rq   r   rr   rb  r   r]  r"   r  r+   r   r-   rs   r0   r(   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   r   rb  rJ   rU   r^  rp  r3   r!   r   r   r   r   rx   s                  r   ;test_unregisterAdapter_hit_w_explicit_provided_and_requiredzKComponentsTests.test_unregisterAdapter_hit_w_explicit_provided_and_requiredj  s   >:?	> 	F|F|	 	 }}Xw5++- 	D**8dWdCE	D001445Wq)1:bR 
5,78
5<<1DEF--56--56..8**B/**B/,,89!	D 	D   1IIc                 <   ddl m} ddl m} ddlm} ddlm}  G d d|      } |d      } |d      } ||       G d	 d
             }| j                         }	|	j                  ||f|       | j                         \  }
}|
5  |	j                  ||f      }d d d        | j                         | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                   |	u        | j                  |j                  j"                  |u        | j                  |j                  j$                  |f       | j                  |j                  j&                  d       | j                  |j                  j(                  d       | j                  |j                  j*                  |u        y # 1 sw Y   }xY w)Nr   rh   ru  r   ra  c                       e Zd Zy)IComponentsTests.test_unregisterAdapter_wo_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd Zy)MComponentsTests.test_unregisterAdapter_wo_explicit_provided.<locals>._FactoryNrG   r&   r   r   rp  r    rP   r   rp  rp   ro   )rS   rD   rv  rq   r   rr   rb  r   r]  r"   r  r+   r(   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   rv  r   rb  rJ   rU   r^  rp  r3   r!   r   r   r   r   rx   s                   r   +test_unregisterAdapter_wo_explicit_providedz;ComponentsTests.test_unregisterAdapter_wo_explicit_provided  s   >;:?	> 	F|F|	T		 	 
	 }}Xw5++- 	>**8dW=E	>Wq)1:bR 
5,78
5<<1DEF--56--56..8**B/**B/,,89	> 	>   HHc                     ddl m} ddlm} ddlm}  G d d|      } |d      } |d       G fdd	      }| j                         }|j                  |f|       | j                         \  }}	|5  |j                  ||
      }
d d d        | j                  
       | j                  t        |	      d       |	d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |u        | j                  |j                  j"                  f       | j                  |j                  j$                  d       | j                  |j                  j&                  d       | j                  |j                  j(                  |u        y # 1 sw Y   }xY w)Nr   rh   r   ra  c                       e Zd Zy)IComponentsTests.test_unregisterAdapter_wo_explicit_required.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd ZW  fZy)MComponentsTests.test_unregisterAdapter_wo_explicit_required.<locals>._FactoryNr  r  s   r   rp  r    r  r   rp  rv   rp   ro   )rS   rD   rq   r   rr   rb  r   r]  r"   r  r+   r(   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   r   rb  rJ   rU   rp  r3   r!   r   r   r   r   rx   r^  s                 @r   +test_unregisterAdapter_wo_explicit_requiredz;ComponentsTests.test_unregisterAdapter_wo_explicit_required  s   >:?	> 	F|F|	+ 	+ }}Xw5++- 	D**8d*CE	DWq)1:bR 
5,78
5<<1DEF--56--56..8**B/**B/,,89	D 	D   4HHc                 v    | j                         }| j                  t        |j                               g        y r   )r   r(   r   registeredAdaptersr;   s     r   test_registeredAdapters_emptyz-ComponentsTests.test_registeredAdapters_empty  s+    }}d5578"=r   c                    ddl m} ddlm}  G d d|      } |d      } |d      }d}d}d} G d	 d
      }	| j	                         }
|
j                  |	|f|||       |
j                  |	|f|||       t        |
j                         d       }| j                  t        |      d       | j                  t        |d   |             | j                  |d   j                  |
u        | j                  |d   j                  |u        | j                  |d   j                  |f       | j                  |d   j                  |u        | j                  |d   j                   |u        | j                  |d   j"                  |	u        | j                  t        |d   |             | j                  |d   j                  |
u        | j                  |d   j                  |u        | j                  |d   j                  |f       | j                  |d   j                  |u        | j                  |d   j                   |u        | j                  |d   j"                  |	u        y )Nr   rh   ra  c                       e Zd Zy)>ComponentsTests.test_registeredAdapters_notempty.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   rQ   r   r   c                       e Zd Zy)BComponentsTests.test_registeredAdapters_notempty.<locals>._FactoryNrG   r&   r   r   rp  r    rK   r   rp  c                     | j                   S r   r  r   s    r   r"  zBComponentsTests.test_registeredAdapters_notempty.<locals>.<lambda>  s
    aff r   r#  r   rp   )rS   rD   rr   rb  r   r]  r%  r  r(   ru   r+   r,   r   rv   ri  r   rQ   r`   )r   rD   rb  rJ   rU   r^  rV   r   r   rp  r3   r&  s               r    test_registeredAdapters_notemptyz0ComponentsTests.test_registeredAdapters_notempty  s   >?	> 	F|F|	 	 }}XwfeDXwfeDT,,.4DES1%
3q6+>?@A4/0A4/0Q4'2Av-.Au,-A(23
3q6+>?@A4/0A4/0Q4'2Av-.Au,-A(23r   c                     ddl m}  G d d|      } |d      }| j                         }t               }| j	                  |j                  ||      d u        y )Nr   rh   c                       e Zd Zy)?ComponentsTests.test_queryAdapter_miss_no_default.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   rS   rD   r   ra   r+   queryAdapter)r   rD   rJ   rU   r3   _contexts         r   !test_queryAdapter_miss_no_defaultz1ComponentsTests.test_queryAdapter_miss_no_default  sJ    >	> 	F|}}8))(D9TABr   c                     ddl m}  G d d|      } |d      }| j                         }t               }t               }| j	                  |j                  |||      |u        y )Nr   rh   c                       e Zd Zy)>ComponentsTests.test_queryAdapter_miss_w_default.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r1  r  )r   rD   rJ   rU   r3   r  r3  s          r    test_queryAdapter_miss_w_defaultz0ComponentsTests.test_queryAdapter_miss_w_default  sZ    >	> 	F|}}88hh?8K	Mr   c                 z   ddl m} ddl m}  G d d|      } |d      } |d      } G d d      } ||       G d	 d
             } |       }| j                         }	|	j	                  ||f|       |	j                  ||      }
| j                  t        |
|             | j                  |
j                  |u        y )Nr   rh   ru  c                       e Zd Zy)3ComponentsTests.test_queryAdapter_hit.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd Zd Zy)7ComponentsTests.test_queryAdapter_hit.<locals>._Factoryc                     || _         y r   rf  r   rg  s     r   r  z@ComponentsTests.test_queryAdapter_hit.<locals>._Factory.__init__
  	    &r   Nr)   rH   rI   r  r&   r   r   rp  r  	      'r   rp  c                       e Zd Zy)7ComponentsTests.test_queryAdapter_hit.<locals>._ContextNrG   r&   r   r   r  r    rP   r   r  )	rS   rD   rv  r   r]  r  r+   r,   rg  r   rD   rv  rJ   rU   r^  rp  r  r  r3   adapters              r   test_queryAdapter_hitz%ComponentsTests.test_queryAdapter_hit  s    >;	> 	F|F|	' 	' 
T		 	 
	:}}Xw5##Hd3
7H56834r   c                     ddl m} ddl m} ddlm}  G d d|      } |d      } |d      } ||       G d d	             } |       }| j                         }	| j                  ||	j                  ||       y )
Nr   rh   ru  r;  c                       e Zd Zy)2ComponentsTests.test_getAdapter_miss.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd Zy)6ComponentsTests.test_getAdapter_miss.<locals>._ContextNrG   r&   r   r   r  r    rP   r   r  )rS   rD   rv  rq   r<  r   rb   
getAdapter)
r   rD   rv  r<  rJ   rU   r^  r  r  r3   s
             r   test_getAdapter_missz$ComponentsTests.test_getAdapter_miss  ss    >;B	> 	F|F|	T		 	 
	:}}.//8T	;r   c                 f   ddl m} ddl m}  G d d|      } |d      } |d      } G d d      } ||       G d	 d
             } |       }| j                         }	|	j	                  ||f|       |	j                  ||      }
| j                  |
|       | j                  |
j                  |       y )Nr   rh   ru  c                       e Zd Zy)1ComponentsTests.test_getAdapter_hit.<locals>.IFooNrG   r&   r   r   rJ   r  )  rK   r   rJ   r   c                       e Zd Zd Zy)5ComponentsTests.test_getAdapter_hit.<locals>._Factoryc                     || _         y r   rf  r  s     r   r  z>ComponentsTests.test_getAdapter_hit.<locals>._Factory.__init__.  r  r   Nr  r&   r   r   rp  r  -  r  r   rp  c                       e Zd Zy)5ComponentsTests.test_getAdapter_hit.<locals>._ContextNrG   r&   r   r   r  r	  0  rP   r   r  )	rS   rD   rv  r   r]  r   assertIsInstanceassertIsrg  r  s              r   test_getAdapter_hitz#ComponentsTests.test_getAdapter_hit&  s    >;	> 	F|F|	' 	' 
T		 	 
	:}}Xw5//(D1gx0goox0r   c                    ddl m} ddlm}  G d d|      } G d d|      } G d d	|      } ||       G d
 d             } ||       G d d|             } G d d      } G d d      }	| j	                         }
|
j                  |	|f|       |
j                  ||f|       | j                  |
        |       }|
j                  ||      }| j                  ||	       | j                  |j                  |       t        ||      }|
j                  ||      }| j                  ||       | j                  |j                  |       y )Nr   r   ru  c                       e Zd Zy)8ComponentsTests.test_getAdapter_hit_super.<locals>.IBaseNrG   r&   r   r   IBaser  >  rK   r   r  c                       e Zd Zy);ComponentsTests.test_getAdapter_hit_super.<locals>.IDerivedNrG   r&   r   r   IDerivedr  A  rK   r   r  c                       e Zd Zy)7ComponentsTests.test_getAdapter_hit_super.<locals>.IFooNrG   r&   r   r   rJ   r  D  rK   r   rJ   c                       e Zd Zy)7ComponentsTests.test_getAdapter_hit_super.<locals>.BaseNrG   r&   r   r   Baser  G  rP   r   r  c                       e Zd Zy):ComponentsTests.test_getAdapter_hit_super.<locals>.DerivedNrG   r&   r   r   Derivedr  K  rP   r   r  c                       e Zd Zd Zy)>ComponentsTests.test_getAdapter_hit_super.<locals>.AdapterBasec                     || _         y r   rf  r  s     r   r  zGComponentsTests.test_getAdapter_hit_super.<locals>.AdapterBase.__init__P  r  r   Nr  r&   r   r   AdapterBaser  O  r  r   r  c                       e Zd Zd Zy)AComponentsTests.test_getAdapter_hit_super.<locals>.AdapterDerivedc                     || _         y r   rf  r  s     r   r  zJComponentsTests.test_getAdapter_hit_super.<locals>.AdapterDerived.__init__T  r  r   Nr  r&   r   r   AdapterDerivedr!  S  r  r   r#  r   r   rS   rv  r   r]  _should_not_changer   r
  r  rg  r   r   r   rv  r  r  rJ   r  r  r  r#  r3   derivedr  super   s                 r   test_getAdapter_hit_superz)ComponentsTests.test_getAdapter_hit_super:  s9   ,;	I 		u 		9 	 
U		 	 
	 
X		d 	 
		' 	'	' 	' }}^h[$?[5(D9%)//'40g~6goow/Wg&//$-g{3goow/r   c                    ddl m} ddlm}  G d d|      } G d d|      } G d d	|      } G d
 d      } G d d|      } ||       G d d|             } ||       G d d||             }	 G d d      }
 G d d      }| j	                         }|j                  ||f|       |j                  |
|f|       | j                  |        |	       }|j                  ||      }| j                  ||       | j                  |j                  |       t        |	|      }|j                  ||      }| j                  ||
       | j                  |j                  |       y )Nr   r   ru  c                       e Zd Zy)aComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.IBaseNrG   r&   r   r   r  r,  j  rK   r   r  c                       e Zd Zy)dComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.IDerivedNrG   r&   r   r   r  r.  m  rK   r   r  c                       e Zd Zy)`ComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.IFooNrG   r&   r   r   rJ   r0  p  rK   r   rJ   c                       e Zd Zy)`ComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.BaseNrG   r&   r   r   r  r2  s  rK   r   r  c                       e Zd Zy)bComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.Child1NrG   r&   r   r   Child1r4  v  rK   r   r5  c                       e Zd Zy)bComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.Child2NrG   r&   r   r   Child2r7  y  rP   r   r8  c                       e Zd Zy)cComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.DerivedNrG   r&   r   r   r  r:  }  rP   r   r  c                       e Zd Zd Zy)gComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.AdapterBasec                     || _         y r   rf  r  s     r   r  zpComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.AdapterBase.__init__  r  r   Nr  r&   r   r   r  r<    r  r   r  c                       e Zd Zd Zy)jComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.AdapterDerivedc                     || _         y r   rf  r  s     r   r  zsComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamond.<locals>.AdapterDerived.__init__  r  r   Nr  r&   r   r   r#  r?    r  r   r#  r$  )r   r   rv  r  r  rJ   r  r5  r8  r  r  r#  r3   r'  r  r(  r   s                   r   Btest_getAdapter_hit_super_when_parent_implements_interface_diamondzRComponentsTests.test_getAdapter_hit_super_when_parent_implements_interface_diamondf  sS   ,;	I 		u 		9 		 		T 	 
U		T 	 
	 
X		ff 	 
		' 	'	' 	' }}^h[$?[5(D9%)//'40g~6goow/Wg&//$-g{3goow/r   c                 :   ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
| j                         }| j	                  |j                  |	|
f|      d        y )Nr   rh   ru  c                       e Zd Zy)9ComponentsTests.test_queryMultiAdapter_miss.<locals>.IFooNrG   r&   r   r   rJ   rD    rK   r   rJ   r   IBazc                       e Zd Zy)>ComponentsTests.test_queryMultiAdapter_miss.<locals>._Context1NrG   r&   r   r   	_Context1rG    rP   r   rH  c                       e Zd Zy)>ComponentsTests.test_queryMultiAdapter_miss.<locals>._Context2NrG   r&   r   r   	_Context2rJ    rP   r   rK  )rS   rD   rv  r   r(   queryMultiAdapterr   rD   rv  rJ   rU   r^  ibazrH  rK  	_context1	_context2r3   s               r   test_queryMultiAdapter_missz+ComponentsTests.test_queryMultiAdapter_miss  s    >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K	}}//I0FM	r   c                 T   ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
t               }| j	                         }| j                  |j                  |	|
f||      |u        y )Nr   rh   ru  c                       e Zd Zy)CComponentsTests.test_queryMultiAdapter_miss_w_default.<locals>.IFooNrG   r&   r   r   rJ   rT    rK   r   rJ   r   rE  c                       e Zd Zy)HComponentsTests.test_queryMultiAdapter_miss_w_default.<locals>._Context1NrG   r&   r   r   rH  rV    rP   r   rH  c                       e Zd Zy)HComponentsTests.test_queryMultiAdapter_miss_w_default.<locals>._Context2NrG   r&   r   r   rK  rX    rP   r   rK  r1  )rS   rD   rv  ra   r   r+   rL  )r   rD   rv  rJ   rU   r^  rN  rH  rK  rO  rP  r3  r3   s                r   %test_queryMultiAdapter_miss_w_defaultz5ComponentsTests.test_queryMultiAdapter_miss_w_default  s    >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K	8}}""Iy#94+3 # 58@A	Br   c                    ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
 G d d      }| j                         }|j	                  |||f|       |j                  |	|
f|      }| j                  t        ||             | j                  |j                  |	|
f       y )Nr   rh   ru  c                       e Zd Zy)8ComponentsTests.test_queryMultiAdapter_hit.<locals>.IFooNrG   r&   r   r   rJ   r\    rK   r   rJ   r   rE  c                       e Zd Zy)=ComponentsTests.test_queryMultiAdapter_hit.<locals>._Context1NrG   r&   r   r   rH  r^    rP   r   rH  c                       e Zd Zy)=ComponentsTests.test_queryMultiAdapter_hit.<locals>._Context2NrG   r&   r   r   rK  r`    rP   r   rK  c                       e Zd Zd Zy)<ComponentsTests.test_queryMultiAdapter_hit.<locals>._Factoryc                     ||f| _         y r   rf  r   context1context2s      r   r  zEComponentsTests.test_queryMultiAdapter_hit.<locals>._Factory.__init__      '1r   Nr  r&   r   r   rp  rb        2r   rp  )
rS   rD   rv  r   r]  rL  r+   r,   r(   rg  r   rD   rv  rJ   rU   r^  rN  rH  rK  rO  rP  rp  r3   r  s                 r   test_queryMultiAdapter_hitz*ComponentsTests.test_queryMultiAdapter_hit  s    >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K		2 	2 }}Xd|T:(()Y)?F
7H569i*@Ar   c                 >   ddl m} ddl m} ddlm}  G d d|      } |d      } |d      } |d      } ||       G d	 d
             } ||       G d d             }	 |       }
 |	       }| j                         }| j                  ||j                  |
|f|       y )Nr   rh   ru  r;  c                       e Zd Zy)7ComponentsTests.test_getMultiAdapter_miss.<locals>.IFooNrG   r&   r   r   rJ   rm    rK   r   rJ   r   rE  c                       e Zd Zy)<ComponentsTests.test_getMultiAdapter_miss.<locals>._Context1NrG   r&   r   r   rH  ro    rP   r   rH  c                       e Zd Zy)<ComponentsTests.test_getMultiAdapter_miss.<locals>._Context2NrG   r&   r   r   rK  rq    rP   r   rK  )rS   rD   rv  rq   r<  r   rb   getMultiAdapter)r   rD   rv  r<  rJ   rU   r^  rN  rH  rK  rO  rP  r3   s                r   test_getMultiAdapter_missz)ComponentsTests.test_getMultiAdapter_miss  s    >;B	> 	F|F|F|	T		 	 
		T		 	 
	K	K	}}...I0F	Nr   c                    ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
 G d d      }| j                         }|j	                  |||f|       |j                  |	|
f|      }| j                  t        ||             | j                  |j                  |	|
f       y )Nr   rh   ru  c                       e Zd Zy)6ComponentsTests.test_getMultiAdapter_hit.<locals>.IFooNrG   r&   r   r   rJ   rv    rK   r   rJ   r   rE  c                       e Zd Zy);ComponentsTests.test_getMultiAdapter_hit.<locals>._Context1NrG   r&   r   r   rH  rx    rP   r   rH  c                       e Zd Zy);ComponentsTests.test_getMultiAdapter_hit.<locals>._Context2NrG   r&   r   r   rK  rz    rP   r   rK  c                       e Zd Zd Zy):ComponentsTests.test_getMultiAdapter_hit.<locals>._Factoryc                     ||f| _         y r   rf  rd  s      r   r  zCComponentsTests.test_getMultiAdapter_hit.<locals>._Factory.__init__  rg  r   Nr  r&   r   r   rp  r|     rh  r   rp  )
rS   rD   rv  r   r]  rr  r+   r,   r(   rg  ri  s                 r   test_getMultiAdapter_hitz(ComponentsTests.test_getMultiAdapter_hit  s    >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K		2 	2 }}Xd|T:&&	9'=tD
7H569i*@Ar   c                 v      fd}||_         ||j                  _         ||j                  j                  _         y )Nc                  (    j                  d       y )NzNothing should get changed)fail)r   r   s    r   
no_changesz6ComponentsTests._should_not_change.<locals>.no_changes  s    II23r   )changedr-   	_v_lookup)r   r3   r  s   `  r   r%  z"ComponentsTests._should_not_change	  s-    	4! **4'r   c                 8   ddl m} ddlm}  G d d|      } G d d|      } G d d	|      } ||       G d
 d             } ||       G d d|             } G d d      } G d d|      }	| j	                         }
|
j                  |	||f|       |
j                  |||f|       | j                  |
        |       }|
j                  ||f|      }| j                  ||	       | j                  |j                  |       | j                  |j                  |       t        ||      }|
j                  ||f|      }| j                  ||       | j                  ||	       | j                  |j                  |       | j                  |j                  |       y )Nr   r   ru  c                       e Zd Zy)=ComponentsTests.test_getMultiAdapter_hit_super.<locals>.IBaseNrG   r&   r   r   r  r    rK   r   r  c                       e Zd Zy)@ComponentsTests.test_getMultiAdapter_hit_super.<locals>.IDerivedNrG   r&   r   r   r  r    rK   r   r  c                       e Zd Zy)<ComponentsTests.test_getMultiAdapter_hit_super.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   c                       e Zd Zy)<ComponentsTests.test_getMultiAdapter_hit_super.<locals>.BaseNrG   r&   r   r   r  r     rP   r   r  c                       e Zd Zy)?ComponentsTests.test_getMultiAdapter_hit_super.<locals>.DerivedNrG   r&   r   r   r  r  $  rP   r   r  c                       e Zd Zd Zy)CComponentsTests.test_getMultiAdapter_hit_super.<locals>.AdapterBasec                      || _         || _        y r   )re  rf  rd  s      r   r  zLComponentsTests.test_getMultiAdapter_hit_super.<locals>.AdapterBase.__init__)  s     ( (r   Nr  r&   r   r   r  r  (  s    )r   r  c                       e Zd Zy)FComponentsTests.test_getMultiAdapter_hit_super.<locals>.AdapterDerivedNrG   r&   r   r   r#  r  -  rK   r   r#  )r   r   rS   rv  r   r]  r%  rr  r
  r  re  rf  r   assertNotIsInstancer&  s                 r   test_getMultiAdapter_hit_superz.ComponentsTests.test_getMultiAdapter_hit_super  s   ,;	I 		u 		9 	 
U		 	 
	 
X		d 	 
		) 	)
	[ 	 }}^h-A4H[5(*;TB%)&&'94@g~6g&&0g&&0Wg&&&g=g{3  .9g&&0g&&0r   c                 L   ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
| j                         }| j	                  t        |j                  |	|
f|            g        y )Nr   rh   ru  c                       e Zd Zy)4ComponentsTests.test_getAdapters_empty.<locals>.IFooNrG   r&   r   r   rJ   r  E  rK   r   rJ   r   rE  c                       e Zd Zy)9ComponentsTests.test_getAdapters_empty.<locals>._Context1NrG   r&   r   r   rH  r  J  rP   r   rH  c                       e Zd Zy)9ComponentsTests.test_getAdapters_empty.<locals>._Context2NrG   r&   r   r   rK  r  M  rP   r   rK  )rS   rD   rv  r   r(   r   getAdaptersrM  s               r   test_getAdapters_emptyz&ComponentsTests.test_getAdapters_emptyB  s    >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K	}}!!9i"8$?@"	Fr   c                    ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
| j                         }g fd}|j	                  |||f|       | j                  t        |j                  |	|
f|            g        | j                  |	|
fg       y )Nr   rh   ru  c                       e Zd Zy)CComponentsTests.test_getAdapters_factory_returns_None.<locals>.IFooNrG   r&   r   r   rJ   r  Y  rK   r   rJ   r   rE  c                       e Zd Zy)HComponentsTests.test_getAdapters_factory_returns_None.<locals>._Context1NrG   r&   r   r   rH  r  ^  rP   r   rH  c                       e Zd Zy)HComponentsTests.test_getAdapters_factory_returns_None.<locals>._Context2NrG   r&   r   r   rK  r  a  rP   r   rK  c                 ,    j                  | |f       y r   r   )re  rf  _called_withs     r   _side_effect_onlyzPComponentsTests.test_getAdapters_factory_returns_None.<locals>._side_effect_onlyh  s    8 45r   )rS   rD   rv  r   r]  r(   r   r  )r   rD   rv  rJ   rU   r^  rN  rH  rK  rO  rP  r3   r  r  s                @r   %test_getAdapters_factory_returns_Nonez5ComponentsTests.test_getAdapters_factory_returns_NoneV  s    >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K	}}	 	.tdC!!9i"8$?@"	FI(>'?@r   c                    ddl m} ddl m}  G d d|      } |d      } |d      } |d      } ||       G d d	             } ||       G d
 d             } |       }	 |       }
 G d d      } G d d      }d}d}| j                         }|j	                  |||f||       |j	                  |||f||       t        |j                  |	|
f|            }| j                  t        |      d       | j                  |d   d   |       | j                  t        |d   d   |             | j                  |d   d   |       | j                  t        |d   d   |             y )Nr   rh   ru  c                       e Zd Zy)8ComponentsTests.test_getAdapters_non_empty.<locals>.IFooNrG   r&   r   r   rJ   r  t  rK   r   rJ   r   rE  c                       e Zd Zy)=ComponentsTests.test_getAdapters_non_empty.<locals>._Context1NrG   r&   r   r   rH  r  y  rP   r   rH  c                       e Zd Zy)=ComponentsTests.test_getAdapters_non_empty.<locals>._Context2NrG   r&   r   r   rK  r  |  rP   r   rK  c                       e Zd Zd Zy)=ComponentsTests.test_getAdapters_non_empty.<locals>._Factory1c                     ||f| _         y r   rf  rd  s      r   r  zFComponentsTests.test_getAdapters_non_empty.<locals>._Factory1.__init__  rg  r   Nr  r&   r   r   	_Factory1r    rh  r   r  c                       e Zd Zd Zy)=ComponentsTests.test_getAdapters_non_empty.<locals>._Factory2c                     ||f| _         y r   rf  rd  s      r   r  zFComponentsTests.test_getAdapters_non_empty.<locals>._Factory2.__init__  rg  r   Nr  r&   r   r   	_Factory2r    rh  r   r  r   r   r  r   rp   )rS   rD   rv  r   r]  r%  r  r(   ru   r+   r,   )r   rD   rv  rJ   rU   r^  rN  rH  rK  rO  rP  r  r  r   r   r3   founds                    r   test_getAdapters_non_emptyz*ComponentsTests.test_getAdapters_non_emptyp  sl   >;	> 	F|F|F|	T		 	 
		T		 	 
	K	K		2 	2	2 	2 }}YtdHYtdHt''I(>EFUQ'q!f-
58A;	:;q!f-
58A;	:;r   c           	          ddl m}  G d d|      } |d      } |d      }d}d}d }| j                         }| j                  t        |j
                  ||f|||       y )	Nr   rh   c                       e Zd Zy)NComponentsTests.test_registerSubscriptionAdapter_w_nonblank_name.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   r   rQ   c                     t               r   rZ   rf  s    r   r\   zRComponentsTests.test_registerSubscriptionAdapter_w_nonblank_name.<locals>._factory  r]   r   )rS   rD   r   rb   rc   registerSubscriptionAdapter)	r   rD   rJ   rU   r^  rw   rV   r\   r3   s	            r   0test_registerSubscriptionAdapter_w_nonblank_namez@ComponentsTests.test_registerSubscriptionAdapter_w_nonblank_name  se    >	> 	F|F|	( }})T%E%E"TGT5%	Ar   c                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      }d}d	}d
 }	| j                         }
| j                         \  }}|5  |
j                  |	|f||       d d d        |
j                  j                  d   |   |   |   }| j                  t        |      d       | j                  |d   |	u        | j                  |
j                  |f|||	|fg       | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                   |             | j                  |j                   j"                  |
u        | j                  |j                   j$                  |u        | j                  |j                   j&                  |f       | j                  |j                   j(                  |       | j                  |j                   j*                  |u        | j                  |j                   j,                  |	u        y # 1 sw Y   xY w)Nr   rh   ri   SubscriptionRegistrationc                       e Zd Zy)_ComponentsTests.test_registerSubscriptionAdapter_w_explicit_provided_and_required.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   ro   rQ   c                     t               r   rZ   rf  s    r   r\   zcComponentsTests.test_registerSubscriptionAdapter_w_explicit_provided_and_required.<locals>._factory  r]   r   rR   rp   rS   rD   rq   rj   rr   r  r   r"   r  r-   rt   r(   ru   r+   r1   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   rj   r  rJ   rU   r^  _blankrV   r\   r3   r!   r   r&  r   r   rx   s                    r   Atest_registerSubscriptionAdapter_w_explicit_provided_and_requiredzQComponentsTests.test_registerSubscriptionAdapter_w_explicit_provided_and_required  s	   >8D	> 	F|F|	(}}++- 	9,,Xw27 - 9	9 mm((+D1$7?S1%A(*+99 7D&(EBC	EWq)1:bR 
5*56
5<<1IJK--56--56..8**F3))U23,,89'	9 	9s   IIc                    ddl m} ddl m} ddlm} ddlm}  G d d|      } |d      } |d      }d	}d
}	 ||       G d d             }
| j                         }| j                         \  }}|5  |j                  |
|f|       d d d        |j                  j                  d   |   |   |	   }| j                  t        |      d       | j                  |d   |
u        | j                  |j                  |f||	|
|fg       | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t!        ||             | j                  t!        |j"                  |             | j                  |j"                  j$                  |u        | j                  |j"                  j&                  |u        | j                  |j"                  j(                  |f       | j                  |j"                  j*                  |	       | j                  |j"                  j,                  |u        | j                  |j"                  j.                  |
u        y # 1 sw Y   xY w)Nr   rh   ru  ri   r  c                       e Zd Zy)SComponentsTests.test_registerSubscriptionAdapter_wo_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   rQ   ro   c                       e Zd Zy)WComponentsTests.test_registerSubscriptionAdapter_wo_explicit_provided.<locals>._FactoryNrG   r&   r   r   rp  r    rP   r   rp  rR   rp   )rS   rD   rv  rq   rj   rr   r  r   r"   r  r-   rt   r(   ru   r+   r1   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   rv  rj   r  rJ   rU   r^  rV   r  rp  r3   r!   r   r&  r   r   rx   s                     r   5test_registerSubscriptionAdapter_wo_explicit_providedzEComponentsTests.test_registerSubscriptionAdapter_wo_explicit_provided  s    >;8D	> 	F|F|	T		 	 
	 }}++- 	L,,XwU,K	Lmm((+D1$7?S1%A(*+99 7D&(EBC	EWq)1:bR 
5*56
5<<1IJK--56--56..8**F3))U23,,89%	L 	Ls   2I))I3c                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      d}d	} G fd
d      }| j                         }	| j                         \  }
}|
5  |	j                  |||       d d d        |	j                  j                  d      |   |   }| j                  t        |      d       | j                  |d   |u        | j                  |	j                  f||||fg       | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                   |             | j                  |j                   j"                  |	u        | j                  |j                   j$                  |u        | j                  |j                   j&                  f       | j                  |j                   j(                  |       | j                  |j                   j*                  |u        | j                  |j                   j,                  |u        y # 1 sw Y   xY w)Nr   rh   ri   r  c                       e Zd Zy)SComponentsTests.test_registerSubscriptionAdapter_wo_explicit_required.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   rQ   ro   c                       e Zd ZW  fZy)WComponentsTests.test_registerSubscriptionAdapter_wo_explicit_required.<locals>._FactoryNr  r  s   r   rp  r    r  r   rp  )rv   rQ   rp   r  )r   rD   rj   r  rJ   rU   rV   r  rp  r3   r!   r   r&  r   r   rx   r^  s                   @r   5test_registerSubscriptionAdapter_wo_explicit_requiredzEComponentsTests.test_registerSubscriptionAdapter_wo_explicit_required  s   >8D	> 	F|F|	+ 	+ }}++- 	9,,t% - 9	9 mm((+D1$7?S1%A(*+99 7D&(EBC	EWq)1:bR 
5*56
5<<1IJK--56--56..8**F3))U23,,89'	9 	9s   $II$c                 ,   ddl m}  G d d|      } |d      } |d      }d}d}d }| j                         }| j                         \  }	}
|	5  |j	                  ||f||d	
       d d d        | j                  t        |
      d       y # 1 sw Y   %xY w)Nr   rh   c                       e Zd Zy)GComponentsTests.test_registerSubscriptionAdapter_wo_event.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   ro   rQ   c                     t               r   rZ   rf  s    r   r\   zKComponentsTests.test_registerSubscriptionAdapter_wo_event.<locals>._factory  r]   r   FrQ   rx   )rS   rD   r   r"   r  r(   ru   )r   rD   rJ   rU   r^  r  rV   r\   r3   r!   r   s              r   )test_registerSubscriptionAdapter_wo_eventz9ComponentsTests.test_registerSubscriptionAdapter_wo_event  s    >	> 	F|F|	( }}++- 	F,,Xw27u - F	F 	Wq)	F 	Fs   B

Bc                 v    | j                         }| j                  t        |j                               g        y r   )r   r(   r   registeredSubscriptionAdaptersr;   s     r   )test_registeredSubscriptionAdapters_emptyz9ComponentsTests.test_registeredSubscriptionAdapters_empty'  s+    }}dAACDbIr   c                    ddl m} ddlm}  G d d|      } |d      } |d      }d}d} G d d	      }| j	                         }	|	j                  ||f||
       |	j                  ||f||
       t        |	j                               }
| j                  t        |
      d       | j                  t        |
d   |             | j                  |
d   j                  |	u        | j                  |
d   j                  |u        | j                  |
d   j                  |f       | j                  |
d   j                  |       | j                  |
d   j                   |u        | j                  |
d   j"                  |u        | j                  t        |
d   |             | j                  |
d   j                  |	u        | j                  |
d   j                  |u        | j                  |
d   j                  |f       | j                  |
d   j                  |       | j                  |
d   j                   |u        | j                  |
d   j"                  |u        y )Nr   rh   r  c                       e Zd Zy)JComponentsTests.test_registeredSubscriptionAdapters_notempty.<locals>.IFooNrG   r&   r   r   rJ   r  /  rK   r   rJ   rQ   ro   c                       e Zd Zy)NComponentsTests.test_registeredSubscriptionAdapters_notempty.<locals>._FactoryNrG   r&   r   r   rp  r  5  rK   r   rp  rR   r   rp   )rS   rD   rr   r  r   r  r   r  r(   ru   r+   r,   r   rv   ri  r   rQ   r`   )r   rD   r  rJ   rU   r^  rV   r  rp  r3   r&  s              r   ,test_registeredSubscriptionAdapters_notemptyz<ComponentsTests.test_registeredSubscriptionAdapters_notempty+  s   >D	> 	F|F|	 	 }}((D7Du(M((D7Du(M46689S1%
3q6+CDEA4/0A4/0Q4'2Qf-Au,-A(23
3q6+CDEA4/0A4/0Q4'2Qf-Au,-A(23r   c                     ddl m}  G d d|      } |d      } |d      }d}| j                         }| j                  t        |j
                  |||       y )Nr   rh   c                       e Zd Zy)PComponentsTests.test_unregisterSubscriptionAdapter_w_nonblank_name.<locals>.IFooNrG   r&   r   r   rJ   r  O  rK   r   rJ   r   nonblank)ri  rv   r   rS   rD   r   rb   rc   unregisterSubscriptionAdapter)r   rD   rJ   rU   r^  	_nonblankr3   s          r   2test_unregisterSubscriptionAdapter_w_nonblank_namezBComponentsTests.test_unregisterSubscriptionAdapter_w_nonblank_nameL  sX    >	> 	F|F|	}})T%G%G#'$Y 	 	Hr   c                 j    | j                         }| j                  t        |j                  d d        y r  )r   rb   rc   r  r;   s     r   ?test_unregisterSubscriptionAdapter_neither_factory_nor_providedzOComponentsTests.test_unregisterSubscriptionAdapter_neither_factory_nor_providedX  s/    }})T%G%G"& 	 	7r   c                     ddl m}  G d d|      } |d      }| j                         }| j                  t        |j
                  d |d        y )Nr   rh   c                       e Zd Zy)]ComponentsTests.test_unregisterSubscriptionAdapter_neither_factory_nor_required.<locals>.IFooNrG   r&   r   r   rJ   r  _  rK   r   rJ   r  r  r,  s        r   ?test_unregisterSubscriptionAdapter_neither_factory_nor_requiredzOComponentsTests.test_unregisterSubscriptionAdapter_neither_factory_nor_required]  sJ    >	> 	F|}})T%G%G"& 	 	Fr   c                 :   ddl m}  G d d|      } |d      } |d      } G d d      }| j                         }| j                         \  }}|5  |j	                  ||f|      }	d d d        | j                  	       | j                  |       y # 1 sw Y   ,xY w)Nr   rh   c                       e Zd Zy)EComponentsTests.test_unregisterSubscriptionAdapter_miss.<locals>.IFooNrG   r&   r   r   rJ   r  h  rK   r   rJ   r   c                       e Zd Zy)IComponentsTests.test_unregisterSubscriptionAdapter_miss.<locals>._FactoryNrG   r&   r   r   rp  r  l  rK   r   rp  )rS   rD   r   r"   r  r   r  s
             r   'test_unregisterSubscriptionAdapter_missz7ComponentsTests.test_unregisterSubscriptionAdapter_missf  s    >	> 	F|F|	 	 }}++- 	P66x$$OE	P!	P 	Ps   BBc                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      } G d d	      }| j                         }|j                  ||f|       | j                         \  }	}
|	5  |j                  d |f|      }d d d        | j                         | j                  |j                  j                         | j                  |j                         | j                  t!        |
      d
       |
d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j$                  |             | j                  |j$                  j&                  |u        | j                  |j$                  j(                  |u        | j                  |j$                  j*                  |f       | j                  |j$                  j,                  d       | j                  |j$                  j.                  d       | j                  |j$                  j0                  d u        y # 1 sw Y   xY w)Nr   rh   r   r  c                       e Zd Zy)OComponentsTests.test_unregisterSubscriptionAdapter_hit_wo_factory.<locals>.IFooNrG   r&   r   r   rJ   r  z  rK   r   rJ   r   c                       e Zd Zy)SComponentsTests.test_unregisterSubscriptionAdapter_hit_wo_factory.<locals>._FactoryNrG   r&   r   r   rp  r  ~  rK   r   rp  rp   ro   rS   rD   rq   r   rr   r  r   r  r"   r  r+   r   r-   rt   r1   r(   ru   r,   ra   r   rv   ri  r   rQ   r`   r   rD   r   r  rJ   rU   r^  rp  r3   r!   r   r   r   r   rx   s                  r   1test_unregisterSubscriptionAdapter_hit_wo_factoryzAComponentsTests.test_unregisterSubscriptionAdapter_hit_wo_factoryv  s   >:D	> 	F|F|	 	 }}((D7DA++- 	L66tdWdKE	L33499:Wq)1:bR 
5,78
5<<1IJK--56--56..8**B/**B/,,45!	L 	Lr  c                    ddl m} ddlm} ddlm}  G d d|      } |d      } |d      } G d d	      }| j                         }|j                  ||f|       | j                         \  }	}
|	5  |j                  ||f|      }d d d        | j                         | j                  |j                  j                         | j                  |j                         | j                  t!        |
      d
       |
d   \  }}|\  }| j                  |i        | j                  t#        ||             | j                  t#        |j$                  |             | j                  |j$                  j&                  |u        | j                  |j$                  j(                  |u        | j                  |j$                  j*                  |f       | j                  |j$                  j,                  d       | j                  |j$                  j.                  d       | j                  |j$                  j0                  |u        y # 1 sw Y   xY w)Nr   rh   r   r  c                       e Zd Zy)NComponentsTests.test_unregisterSubscriptionAdapter_hit_w_factory.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd Zy)RComponentsTests.test_unregisterSubscriptionAdapter_hit_w_factory.<locals>._FactoryNrG   r&   r   r   rp  r    rK   r   rp  rp   ro   r  r   s                  r   0test_unregisterSubscriptionAdapter_hit_w_factoryz@ComponentsTests.test_unregisterSubscriptionAdapter_hit_w_factory  s   >:D	> 	F|F|	 	 }}((D7DA++- 	P66x$$OE	P33499:Wq)1:bR 
5,78
5<<1IJK--56--56..8**B/**B/,,89!	P 	Pr  c                 <   ddl m} ddl m} ddlm} ddlm}  G d d|      } |d      } |d      } ||       G d	 d
             }| j                         }	|	j                  ||f|       | j                         \  }
}|
5  |	j                  ||f      }d d d        | j                         | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                   |	u        | j                  |j                  j"                  |u        | j                  |j                  j$                  |f       | j                  |j                  j&                  d       | j                  |j                  j(                  d       | j                  |j                  j*                  |u        y # 1 sw Y   }xY w)Nr   rh   ru  r   r  c                       e Zd Zy)UComponentsTests.test_unregisterSubscriptionAdapter_wo_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   r
    rK   r   rJ   r   c                       e Zd Zy)YComponentsTests.test_unregisterSubscriptionAdapter_wo_explicit_provided.<locals>._FactoryNrG   r&   r   r   rp  r    rP   r   rp  rp   ro   )rS   rD   rv  rq   r   rr   r  r   r  r"   r  r+   r(   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   rv  r   r  rJ   rU   r^  rp  r3   r!   r   r   r   r   rx   s                   r   7test_unregisterSubscriptionAdapter_wo_explicit_providedzGComponentsTests.test_unregisterSubscriptionAdapter_wo_explicit_provided  s   >;:D	> 	F|F|	T		 	 
	 }}((D7DA++- 	J66x$IE	JWq)1:bR 
5,78
5<<1IJK--56--56..8**B/**B/,,89	J 	Jr  c                     ddl m} ddlm} ddlm}  G d d|      } |d      } |d       G fdd	      }| j                         }|j                  |f|       | j                         \  }}	|5  |j                  ||
      }
d d d        | j                  
       | j                  t        |	      d       |	d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |u        | j                  |j                  j"                  f       | j                  |j                  j$                  d       | j                  |j                  j&                  d       | j                  |j                  j(                  |u        y # 1 sw Y   }xY w)Nr   rh   r   r  c                       e Zd Zy)UComponentsTests.test_unregisterSubscriptionAdapter_wo_explicit_required.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd ZW  fZy)YComponentsTests.test_unregisterSubscriptionAdapter_wo_explicit_required.<locals>._FactoryNr  r  s   r   rp  r    r  r   rp  r  rp   ro   )rS   rD   rq   r   rr   r  r   r  r"   r  r+   r(   ru   r,   ra   r   rv   ri  r   rQ   r`   )r   rD   r   r  rJ   rU   rp  r3   r!   r   r   r   r   rx   r^  s                 @r   7test_unregisterSubscriptionAdapter_wo_explicit_requiredzGComponentsTests.test_unregisterSubscriptionAdapter_wo_explicit_required  s   >:D	> 	F|F|	+ 	+ }}((D7DA++- 	P66x$6OE	PWq)1:bR 
5,78
5<<1IJK--56--56..8**B/**B/,,89	P 	Pr  c                    ddl m} ddl m}  G d d|      } |d      } |d      }| j                         } ||       G d d             } |       }| j	                  t        |j                  |f|            g        y )	Nr   rh   ru  c                       e Zd Zy)4ComponentsTests.test_subscribers_empty.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd Zy)3ComponentsTests.test_subscribers_empty.<locals>.BarNrG   r&   r   r   Barr    rP   r   r  )rS   rD   rv  r   r(   r   subscribers)	r   rD   rv  rJ   rU   r^  r3   r  bars	            r   test_subscribers_emptyz&ComponentsTests.test_subscribers_empty  sx    >;	> 	F|F|}}	T		 	 
	ed..vt<=rBr   c                    ddl m} ddl m}  G d d|      } |d      } |d       G fdd      } G d	 d
|      }| j                         }|j	                  |f|       |j	                  |f|        |       G d d             } |       }	|j                  |	f|      }
d }t        |
|      }
| j                  t        |
      d       | j                  t        |
d   |             | j                  t        |
d   |             y )Nr   rh   ru  c                       e Zd Zy)8ComponentsTests.test_subscribers_non_empty.<locals>.IFooNrG   r&   r   r   rJ   r    rK   r   rJ   r   c                       e Zd ZW  fZd Zy)<ComponentsTests.test_subscribers_non_empty.<locals>._Factoryc                     || _         y r   )r  r  s     r   r  zEComponentsTests.test_subscribers_non_empty.<locals>._Factory.__init__  s	     'r   N)r)   rH   rI   r  r  r  s   r   rp  r!  	  s    $(7 (r   rp  c                       e Zd Zy)<ComponentsTests.test_subscribers_non_empty.<locals>._DerivedNrG   r&   r   r   _Derivedr$    rK   r   r%  c                       e Zd Zy)7ComponentsTests.test_subscribers_non_empty.<locals>.BarNrG   r&   r   r   r  r'    rP   r   r  c                 .    | j                   j                  S r   )r   r)   xs    r   
_klassnamez>ComponentsTests.test_subscribers_non_empty.<locals>._klassname  s    ;;'''r   r#  r   rp   )rS   rD   rv  r   r  r  r%  r(   ru   r+   r,   )r   rD   rv  rJ   rU   rp  r%  r3   r  r  r  r+  r^  s               @r   test_subscribers_non_emptyz*ComponentsTests.test_subscribers_non_empty  s    >;	> 	F|F|	( 	(	x 	}}((D7DA((D7DA	T		 	 
	e&&vt4	([j9[)1-
;q>8<=
;q>8<=r   c                     ddl m}  G d d|      } |d      }d}| j                         }d }| j                  t        |j
                  |||       y )Nr   rh   c                       e Zd Zy)BComponentsTests.test_registerHandler_w_nonblank_name.<locals>.IFooNrG   r&   r   r   rJ   r/  !  rK   r   rJ   r  c                     t               r   rZ   rf  s    r   r\   zFComponentsTests.test_registerHandler_w_nonblank_name.<locals>._factory&  r]   r   ri  r   )rS   rD   r   rb   rc   registerHandler)r   rD   rJ   rU   r  r3   r\   s          r   $test_registerHandler_w_nonblank_namez4ComponentsTests.test_registerHandler_w_nonblank_name  sU    >	> 	F|	}}	( 	)T%9%98#'i 	 	9r   c                 \   ddl m} ddlm} ddlm}  G d d|      } |d      }d}d}d	 }| j                         }	| j                         \  }
}|
5  |	j                  ||f|
       d d d        |	j                  j                  d   |   d    |   }| j                  t        |      d       | j                  |d   |u        | j                  |	j                  |f|||fg       | j                  t        |      d       |d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                   |             | j                  |j                   j"                  |	u        | j                  |j                   j$                  |f       | j                  |j                   j&                  |       | j                  |j                   j(                  |u        | j                  |j                   j*                  |u        y # 1 sw Y   xY w)Nr   rh   ri   HandlerRegistrationc                       e Zd Zy)FComponentsTests.test_registerHandler_w_explicit_required.<locals>.IFooNrG   r&   r   r   rJ   r8  1  rK   r   rJ   ro   rQ   c                     t               r   rZ   rf  s    r   r\   zJComponentsTests.test_registerHandler_w_explicit_required.<locals>._factory6  r]   r   rR   rp   )rS   rD   rq   rj   rr   r6  r   r"   r2  r-   rt   r(   ru   r+   r2   r,   ra   r   ri  r   rQ   r`   )r   rD   rj   r6  rJ   rU   r  rV   r\   r3   r!   r   r&  r   r   rx   s                   r   (test_registerHandler_w_explicit_requiredz8ComponentsTests.test_registerHandler_w_explicit_required,  s   >8?	> 	F|	( }}++- 	@  D7 ?	@mm((+D1$7?S1%A(*+44 7FHe<=	?Wq)1:bR 
5*56
5<<1DEF--56..8**F3))U23,,89#	@ 	@s   H!!H+c                   
 ddl m}  G d d|      } |d      
d}d} G 
fdd      }| j                         }| j                         \  }}|5  |j	                  ||d	
       d d d        |j
                  j                  d   
   d    |   }	| j                  t        |	      d       | j                  |	d   |u        | j                  |j                  
f|||fg       | j                  t        |      d       y # 1 sw Y   xY w)Nr   rh   c                       e Zd Zy)PComponentsTests.test_registerHandler_wo_explicit_required_no_event.<locals>.IFooNrG   r&   r   r   rJ   r=  Q  rK   r   rJ   rQ   ro   c                       e Zd ZW  fZy)TComponentsTests.test_registerHandler_wo_explicit_required_no_event.<locals>._FactoryNr  rU   s   r   rp  r?  V  s    $(7 r   rp  Fr  rp   )rS   rD   r   r"   r2  r-   rt   r(   ru   r+   r2   )r   rD   rJ   rV   r  rp  r3   r!   r   r&  rU   s             @r   2test_registerHandler_wo_explicit_required_no_eventzBComponentsTests.test_registerHandler_wo_explicit_required_no_eventN  s   >	> 	F|	 	 }}++- 	D  U C	Dmm((+D1$7?S1%A(*+44 7FHe<=	?Wq)	D 	Ds   C>>Dc                 t    | j                         }| j                  t        |j                                      y r   )r   r   r   registeredHandlersr;   s     r   test_registeredHandlers_emptyz-ComponentsTests.test_registeredHandlers_emptye  s)    }}d55789r   c                    ddl m} ddlm}  G d d|      } |d      }d }d }| j	                         }|j                  ||f       |j                  ||f       d }t        |j                         |	      }	| j                  t        |	      d
       | j                  t        |	d   |             | j                  |	d   j                  |f       | j                  |	d   j                  d       | j                  |	d   j                  |       | j                  |	d   j                  d       | j                  t        |	d   |             | j                  |	d   j                  |f       | j                  |	d   j                  d       | j                  |	d   j                  |       | j                  |	d   j                  d       y )Nr   rh   r5  c                       e Zd Zy)?ComponentsTests.test_registeredHandlers_non_empty.<locals>.IFooNrG   r&   r   r   rJ   rG  l  rK   r   rJ   c                     t               r   rZ   rf  s    r   	_factory1zDComponentsTests.test_registeredHandlers_non_empty.<locals>._factory1o  r]   r   c                     t               r   rZ   rf  s    r   	_factory2zDComponentsTests.test_registeredHandlers_non_empty.<locals>._factory2q  r]   r   c                 B    | j                   j                  j                  S r   )r`   __code__co_namer)  s    r   _factory_namezHComponentsTests.test_registeredHandlers_non_empty.<locals>._factory_namev  s    99%%---r   r#  r   ro   rp   )rS   rD   rr   r6  r   r2  r%  rC  r(   ru   r+   r,   ri  r   r`   rQ   )
r   rD   r6  rJ   rU   rI  rK  r3   rO  r  s
             r   !test_registeredHandlers_non_emptyz1ComponentsTests.test_registeredHandlers_non_emptyi  s   >?	> 	F|	(	(}}Y0Y0	.T446MJ[)1-
;q>3FGHQ004':Q,,b1Q//;Q,,b1
;q>3FGHQ004':Q,,b1Q//;Q,,b1r   c                     ddl m}  G d d|      } |d      }d}| j                         }| j                  t        |j
                  |f|       y )Nr   rh   c                       e Zd Zy)DComponentsTests.test_unregisterHandler_w_nonblank_name.<locals>.IFooNrG   r&   r   r   rJ   rS    rK   r   rJ   r  r1  )rS   rD   r   rb   rc   unregisterHandler)r   rD   rJ   rU   r  r3   s         r   &test_unregisterHandler_w_nonblank_namez6ComponentsTests.test_unregisterHandler_w_nonblank_name  sN    >	> 	F|	}})T%;%;$(7 	 	<r   c                 d    | j                         }| j                  t        |j                         y r   )r   rb   rc   rT  r;   s     r   3test_unregisterHandler_neither_factory_nor_requiredzCComponentsTests.test_unregisterHandler_neither_factory_nor_required  s#    }})T%;%;<r   c                     ddl m}  G d d|      } |d      }| j                         }|j                  |f      }| j	                  |       y )Nr   rh   c                       e Zd Zy)9ComponentsTests.test_unregisterHandler_miss.<locals>.IFooNrG   r&   r   r   rJ   rZ    rK   r   rJ   ri  )rS   rD   r   rT  r   )r   rD   rJ   rU   r3   r   s         r   test_unregisterHandler_missz+ComponentsTests.test_unregisterHandler_miss  sH    >	> 	F|}}&&&8r   c                    ddl m} ddlm} ddlm}  G d d|      } |d      }| j                         }d }| j                         }|j                  ||f       | j                         \  }}	|5  |j                  ||f      }
d d d        | j                  
       | j                  t        |	      d       |	d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |f       | j                  |j                  j"                  d	       | j                  |j                  j$                  |u        y # 1 sw Y   0xY w)
Nr   rh   r   r5  c                       e Zd Zy)XComponentsTests.test_unregisterHandler_hit_w_factory_and_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   r_    rK   r   rJ   c                     t               r   rZ   rf  s    r   r\   z\ComponentsTests.test_unregisterHandler_hit_w_factory_and_explicit_provided.<locals>._factory  r]   r   rp   ro   rS   rD   rq   r   rr   r6  r   r2  r"   rT  r+   r(   ru   r,   ra   r   ri  r   r`   r   rD   r   r6  rJ   rU   r3   r\   r!   r   r   r   r   rx   s                 r   :test_unregisterHandler_hit_w_factory_and_explicit_providedzJComponentsTests.test_unregisterHandler_hit_w_factory_and_explicit_provided  sg   >:?	> 	F|}}	(}}Xw/++- 	>**8dW=E	>Wq)1:bR 
5,78
5<<1DEF--56..8**B/,,89	> 	>   1F33F=c                    ddl m} ddlm} ddlm}  G d d|      } |d      }| j                         }d }| j                         }|j                  ||f       | j                         \  }}	|5  |j                  |f      }
d d d        | j                  
       | j                  t        |	      d	       |	d   \  }}|\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   |f       | j                  |j                  j"                  d
       | j                  |j                  j$                  d u        y # 1 sw Y   0xY w)Nr   rh   r   r5  c                       e Zd Zy)QComponentsTests.test_unregisterHandler_hit_w_only_explicit_provided.<locals>.IFooNrG   r&   r   r   rJ   rg    rK   r   rJ   c                     t               r   rZ   rf  s    r   r\   zUComponentsTests.test_unregisterHandler_hit_w_only_explicit_provided.<locals>._factory  r]   r   r[  rp   ro   ra  rb  s                 r   3test_unregisterHandler_hit_w_only_explicit_providedzCComponentsTests.test_unregisterHandler_hit_w_only_explicit_provided  sh   >:?	> 	F|}}	(}}Xw/++- 	=**TG*<E	=Wq)1:bR 
5,78
5<<1DEF--56..8**B/,,45	= 	=rd  c                    ddl m} ddlm} ddlm}  G d d|      } |d       G fdd      }| j                         }|j                  |       | j                         \  }}|5  |j                  |      }	d d d        | j                  	       | j                  t        |      d	       |d   \  }
}|
\  }| j                  |i        | j                  t        ||             | j                  t        |j                  |             | j                  |j                  j                  |u        | j                  |j                  j                   f       | j                  |j                  j"                  d
       | j                  |j                  j$                  d
       | j                  |j                  j&                  |u        y # 1 sw Y   VxY w)Nr   rh   r   r5  c                       e Zd Zy)IComponentsTests.test_unregisterHandler_wo_explicit_required.<locals>.IFooNrG   r&   r   r   rJ   rl    rK   r   rJ   c                       e Zd ZW  fZy)MComponentsTests.test_unregisterHandler_wo_explicit_required.<locals>._FactoryNr  r@  s   r   rp  rn    r  r   rp  rp   ro   )rS   rD   rq   r   rr   r6  r   r2  r"   rT  r+   r(   ru   r,   ra   r   ri  r   rQ   r`   )r   rD   r   r6  rJ   rp  r3   r!   r   r   r   r   rx   rU   s                @r   +test_unregisterHandler_wo_explicit_requiredz;ComponentsTests.test_unregisterHandler_wo_explicit_required  sv   >:?	> 	F|	+ 	+ }}X&++- 	5**84E	5Wq)1:bR 
5,78
5<<1DEF--56..8**B/**B/,,89	5 	5s   )GGc                     ddl m} ddl m}  G d d|      } |d      }| j                         } ||       G d d             } |       }|j	                  |f       y )Nr   rh   ru  c                       e Zd Zy)/ComponentsTests.test_handle_empty.<locals>.IFooNrG   r&   r   r   rJ   rr    rK   r   rJ   c                       e Zd Zy).ComponentsTests.test_handle_empty.<locals>.BarNrG   r&   r   r   r  rt    rP   r   r  )rS   rD   rv  r   handle)r   rD   rv  rJ   rU   r3   r  r  s           r   test_handle_emptyz!ComponentsTests.test_handle_empty  sY    >;	> 	F|}}	T		 	 
	eSFr   c                 t  
 ddl m} ddl m}  G d d|      } |d      }g 

fd}g fd}| j                         }|j	                  ||f       |j	                  ||f        ||       G d d	             } |       }	|j                  |	       | j                  
|	g       | j                  |	g       y )
Nr   rh   ru  c                       e Zd Zy)3ComponentsTests.test_handle_non_empty.<locals>.IFooNrG   r&   r   r   rJ   ry    rK   r   rJ   c                 (    j                  |        y r   r   )rg  	_called_1s    r   
_factory_1z9ComponentsTests.test_handle_non_empty.<locals>._factory_1	        )r   c                 (    j                  |        y r   r   )rg  	_called_2s    r   
_factory_2z9ComponentsTests.test_handle_non_empty.<locals>._factory_2	  r}  r   c                       e Zd Zy)2ComponentsTests.test_handle_non_empty.<locals>.BarNrG   r&   r   r   r  r  	  rP   r   r  )rS   rD   rv  r   r2  ru  r(   )r   rD   rv  rJ   rU   r|  r  r3   r  r  r{  r  s             @@r   test_handle_non_emptyz%ComponentsTests.test_handle_non_empty  s    >;	> 	F|		*		*}}Z$1Z$1	T		 	 
	eCSE*SE*r   c                     G d dt               }| j                         }t               }|r|n	t               }|j                  ||       |j                  ||d       | j	                  t        |j                  j                        d       | j	                  |j                  j                  |d|r|fn||fiig       | j	                  |j                  j                  ||rdnd	i       |j                  ||      }| j                  |       |j                  ||d      }| j                  |       | j	                  |j                  j                  i        | j	                  t        |j                  j                        d
       y )Nc                       e Zd Zy)QComponentsTests.test_register_unregister_identical_objects_provided.<locals>.IFooNrG   r&   r   r   rJ   r  	  rK   r   rJ   r  r  r   rp   ro   r      r   )r   r   ra   rT   r(   ru   r.   rt   	_providedr   r+   )r   	identicalrJ   r3   firstsecondress          r   3test_register_unregister_identical_objects_providedzCComponentsTests.test_register_unregister_identical_objects_provided	  sU   	9 	 }}#UT2Vd?T^^8891=442IyE6?C8
 7 	 	11y!a4
 	 $$UT$:$$Vd$G1126T^^8891=r   c                 (    | j                  d       y )NF)r  )r  r   s    r   2test_register_unregister_nonequal_objects_providedzBComponentsTests.test_register_unregister_nonequal_objects_provided/	  s    @@5@Qr   c                     G d dt               } G d d      }| j                         }t        d      D ]*  }|j                   |       |dj	                  |             , |j
                  j                  }|j
                  j                  }| j                  t        |      d       | j                  t        |d	         d       | j                  t        |d	   |         d       |j
                  j                  }| j                  t        |      d       | j                  t        |d	         d       | j                  t        |d	   |         d       | j                  t        |d	   |   d
         d        t        |             x}|j
                  _        |j                  i        i x}	|d	   |<   t        d      D ]$  }
t        t        |
            }
|d	   |   |
   |	|
<   & | j                  ||        t        |             x}|j
                  _
        |j                  i        i x}	|d	   |<   d|	d
<   t        dd      D ]/  }
t        t        |
            }
|d	   |   |
   }|	d
xx   |fz  cc<   1 |j                         }| j                  |j
                  j                  |       | j                  |ddddd       |j                  d      }| j                  |j
                  j                  |dz          | j                  ||       | j                  ||       | j                  t        |d	   |   d
         t        |d	   |   d
                |d	   |   d
   D ]  }| j!                  ||d	   |   d
           |j                         }| j                  |dd	dd	d       |j                  d      }| j                  ||       | j                  |j
                  j                  |dz          y )Nc                       e Zd ZdZy)GComponentsTests.test_rebuildUtilityRegistryFromLocalCache.<locals>.IFooDoes nothingNr)   rH   rI   __doc__r&   r   r   rJ   r  3	      r   rJ   c                       e Zd ZdZy)YComponentsTests.test_rebuildUtilityRegistryFromLocalCache.<locals>.UtilityImplementingFoor  Nr  r&   r   r   UtilityImplementingFoor  6	  r  r   r     z{}r  rp   r   ro   
   r&                  )did_not_registerneeded_registereddid_not_subscribeneeded_subscribedT)rebuild)r   r   rangerT   formatr.   _generationrs   r(   ru   rt   typer   strassertNotEqual$rebuildUtilityRegistryFromLocalCacheassertIn)r   rJ   r  compsiorig_generationorig_adaptersorig_subscribersnew_adaptersdr   new_subscribersr3   rebuild_results_preflightrebuild_resultsorig_subscriberpreflight_afterrebuild_afters                     r   )test_rebuildUtilityRegistryFromLocalCachez9ComponentsTests.test_rebuildUtilityRegistryFromLocalCache2	  s   	9 		 	 r 	WA!!"8":Dt{{ST~!V	W  //5511]+Q/]1-.2]1-d34b9 ??77-.2-a0115-a067;-a06r:;R@ 4G43F3HHu0B$&&LOD!"I 	3Ds4y>D#A&t,T2AdG	3 	M<89O>N9O9QQ%//6r"'))OAt$"!RL 	Ds4y>D #D)$/DbEdWE	 %*$N$N$P!44oF2 "!#!"!#5
 	  DDTDR 	44o6IJ2OD}5"4(,- #D)"-.	0  0248< 	IOMM/?1+=d+CB+GH	I  DDF "!"!#!"+
 	 BB4BP844o6IJr   )test)T)vr)   rH   rI   r   r   r"   r4   r7   r<   r@   rW   rf   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r
  r  r  r  r  r'  r-  r4  r9  r@  rD  rI  rN  rS  rW  r_  rj  rs  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r)  rA  rQ  rY  rj  rs  r~  r%  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r,  r3  r:  rA  rD  rP  rU  rW  r\  rc  ri  ro  rv  r  r  r  r  r   r   s   @r   r	   r	      sw   9 :F=	= (?6@:<	M6@* %*10'6RO"*C,C>G
?"6>:> 6D!6FO$O$O,>6(((,?0>9O<G:?AL$*!:F2"%:NA G!:F(:TA":H*&7
F :@:@:<> 4DC	M5(; 1(*0X00d(B,B2N*B25-1^F(A4!<FA ":H%:N#:J*(J4B
H7
F" 6@:@:@:<C>89 :D*.:28	<= :666:8+.>8RTKr   r	   c                        e Zd Z fdZ xZS )UnhashableComponentsTestsc                 H     G d dt         t        |          t              }|S )Nc                       e Zd Zy)=UnhashableComponentsTests._getTargetClass.<locals>.ComponentsNrG   r&   r   r   r   r  	  rK   r   r   )r   r  r   r   )r   r   r   s     r   r   z)UnhashableComponentsTests._getTargetClass	  s#    	8$OQSW 	r   )r)   rH   rI   r   r   r   s   @r   r  r  	  s     r   r  c                       e Zd Zd Zdd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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)UtilityRegistrationTestsc                     ddl m} |S )Nr   rk   )rr   rl   )r   rl   s     r   r   z(UtilityRegistrationTests._getTargetClass	      ?""r   Nc                     ddl m}  G d d|      } |d      } G d d      } |       }d}d	}	| j                         }
 |
|||||	|      ||fS )
Nr   rh   c                       e Zd Zy)AUtilityRegistrationTests._makeOne.<locals>.InterfaceClassSubclassNrG   r&   r   r   InterfaceClassSubclassr  	  rK   r   r  rJ   c                       e Zd Zd Zy)4UtilityRegistrationTests._makeOne.<locals>._Registryc                      yN	_REGISTRYr&   r   s    r   __repr__z=UtilityRegistrationTests._makeOne.<locals>._Registry.__repr__	      "r   Nr)   rH   rI   r  r&   r   r   	_Registryr  	      #r   r  r   	DOCSTRINGrS   rD   r   )r   r_   r`   rD   r  rU   r  r   r   docklasss              r   r   z!UtilityRegistrationTests._makeOne	  sj    >	^ 	 &f-	# 	# ;$$&hdIsGD 	r   c                 J    ddl m} ddlm}  ||| j	                                y )Nr   verifyClassIUtilityRegistration)zope.interface.verifyr  rq   r  r   )r   r  r  s      r   +test_class_conforms_to_IUtilityRegistrationzDUtilityRegistrationTests.test_class_conforms_to_IUtilityRegistration	      5B($*>*>*@Ar   c                 V    ddl m} ddlm} | j	                         \  }}} |||       y )Nr   verifyObjectr  )r  r  rq   r  r   )r   r  r  ur_s        r   .test_instance_conforms_to_IUtilityRegistrationzGUtilityRegistrationTests.test_instance_conforms_to_IUtilityRegistration	  $    6BMMOAq)2.r   c                      G d d      } |       }| j                  |      \  }}}| j                  t        |      d|z         y )Nc                       e Zd ZdZ y):UtilityRegistrationTests.test___repr__.<locals>._ComponentTESTNrG   r&   r   r   
_Componentr  	      Hr   r  zAUtilityRegistration(_REGISTRY, IFoo, %r, TEST, None, 'DOCSTRING')r9   r   r  
_componentr  	_registryrw   s         r   r<   z&UtilityRegistrationTests.test___repr__	  sG    	 	\
#}}Z8IubO$&	'r   c                      G d d      } |       }| j                  |      \  }}}t               |_        | j                  t	        |      d|z         y )Nc                       e Zd Zd Zy)KUtilityRegistrationTests.test___repr___provided_wo_name.<locals>._Componentc                      yNr  r&   r   s    r   r  zTUtilityRegistrationTests.test___repr___provided_wo_name.<locals>._Component.__repr__	      r   Nr  r&   r   r   r  r  	      r   r  AUtilityRegistration(_REGISTRY, None, %r, TEST, None, 'DOCSTRING')r   ra   rv   r(   r:   r  s         r   test___repr___provided_wo_namez7UtilityRegistrationTests.test___repr___provided_wo_name	  R    	 	  \
#}}Z8IuhbO$&	'r   c                      G d d      } |       }| j                  |      \  }}}t               |_        | j                  t	        |      d|z         y )Nc                       e Zd Zd Zy)LUtilityRegistrationTests.test___repr___component_wo_name.<locals>._Componentc                      yr  r&   r   s    r   r  zUUtilityRegistrationTests.test___repr___component_wo_name.<locals>._Component.__repr__	  r  r   Nr  r&   r   r   r  r  	  r  r   r  r  r  r  s         r   test___repr___component_wo_namez8UtilityRegistrationTests.test___repr___component_wo_name	  r  r   c                     t               }| j                  |      \  }}}| j                  |j                         t	        |             y r   ra   r   r(   __hash__idr   r  r  r  rw   s        r   test___hash__z&UtilityRegistrationTests.test___hash__	  8    X
#}}Z8Iu2/r   c                 j    t               }| j                  |      \  }}}| j                  ||k(         y r   ra   r   r+   r  s        r   test___eq___identityz-UtilityRegistrationTests.test___eq___identity	  .    X
#}}Z8Iub!r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k(         y r   r  r   r  r  r  rw   ur2r  s          r   test___eq___hitz(UtilityRegistrationTests.test___eq___hit	  B    X
#}}Z8IuMM*-	Qc	"r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k(         y r   ra   r   r   r   r  _component2r  r  rw   r  r  s           r   test___eq___missz)UtilityRegistrationTests.test___eq___miss	  K    X
h#}}Z8IuMM+.	Qs#r   c                 j    t               }| j                  |      \  }}}| j                  ||k7         y r   r  r  s        r   test___ne___identityz-UtilityRegistrationTests.test___ne___identity	  0    X
#}}Z8Iur"r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k7         y r   r  r  s          r   test___ne___hitz(UtilityRegistrationTests.test___ne___hit	  D    X
#}}Z8IuMM*-	Qs#r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k7         y r   r  r  s           r   test___ne___missz)UtilityRegistrationTests.test___ne___miss	  I    X
h#}}Z8IuMM+.	Qc	"r   c                 j    t               }| j                  |      \  }}}| j                  ||k         y r   r  r  s        r   test___lt___identityz-UtilityRegistrationTests.test___lt___identity
  0    X
#}}Z8Iub!r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k         y r   r  r  s          r   test___lt___hitz(UtilityRegistrationTests.test___lt___hit
  D    X
#}}Z8IuMM*-	Qc"r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k         y N2ra   r   r   r+   r  s           r   test___lt___missz)UtilityRegistrationTests.test___lt___miss
  T    X
h#}}Z8IuMM+.	Q3;S!r   c                 j    t               }| j                  |      \  }}}| j                  ||k         y r   r  r  s        r   test___le___identityz-UtilityRegistrationTests.test___le___identity
  r
  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k         y r   r  r  s          r   test___le___hitz(UtilityRegistrationTests.test___le___hit
  r  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k         y r&  r(  r  s           r   test___le___missz)UtilityRegistrationTests.test___le___miss 
  T    X
h#}}Z8IuMM+.	Q3;c	"r   c                 j    t               }| j                  |      \  }}}| j                  ||kD         y r   r  r  s        r   test___gt___identityz-UtilityRegistrationTests.test___gt___identity(
  r!  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||kD         y r&  r(  r  s           r   test___gt___hitz(UtilityRegistrationTests.test___gt___hit-
  T    X
h#}}Z8IuMM+.	Q3;b!r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||kD         y r   r  r  s          r   test___gt___missz)UtilityRegistrationTests.test___gt___miss5
  D    X
#}}Z8IuMM*-	Qr"r   c                 j    t               }| j                  |      \  }}}| j                  ||k\         y r   r  r  s        r   test___ge___identityz-UtilityRegistrationTests.test___ge___identity;
  r
  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k\         y r&  ra   r   r   r   r  s           r   test___ge___missz)UtilityRegistrationTests.test___ge___miss@
  V    X
h#}}Z8IuMM+.	Q3;s#r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k\         y r&  r(  r  s          r   test___ge___hitz(UtilityRegistrationTests.test___ge___hitH
  M    X
#}}Z8IuMM*-	Q3;r	"r   )NN)r)   rH   rI   r   r   r  r  r<   r  r  r  r	  r  r  r  r  r  r   r#  r)  r,  r.  r0  r3  r5  r8  r;  r>  rA  r&   r   r   r  r  	  s    #&B
/'	'	'0
"
#$#
$#"
#""
##"
"#"
$#r   r  c                       e Zd Zd Zdd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d 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d Zy)AdapterRegistrationTestsc                     ddl m} |S )Nr   ra  )rr   rb  )r   rb  s     r   r   z(AdapterRegistrationTests._getTargetClassR
  r  r   Nc                     ddl m}  G d d|      } |d      } |d      } G d d      } |       }d}d	}	| j                         }
 |
||f||||	      ||fS )
Nr   rh   c                       e Zd Zy)/AdapterRegistrationTests._makeOne.<locals>.IFooNrG   r&   r   r   rJ   rH  Y
  rK   r   rJ   r   c                       e Zd Zd Zy)4AdapterRegistrationTests._makeOne.<locals>._Registryc                      yr  r&   r   s    r   r  z=AdapterRegistrationTests._makeOne.<locals>._Registry.__repr__^
  r  r   Nr  r&   r   r   r  rJ  ]
  r  r   r  r   r  r  r   r_   rD   rJ   rU   r^  r  r   r   r  r  s              r   r   z!AdapterRegistrationTests._makeOneV
  r    >	> 	F|F|	# 	# ;$$&htYD 	r   c                 J    ddl m} ddlm}  ||| j	                                y )Nr   r  IAdapterRegistration)r  r  rq   rP  r   )r   r  rP  s      r   +test_class_conforms_to_IAdapterRegistrationzDAdapterRegistrationTests.test_class_conforms_to_IAdapterRegistrationi
  r  r   c                 V    ddl m} ddlm} | j	                         \  }}} |||       y )Nr   r  rO  )r  r  rq   rP  r   )r   r  rP  arr  s        r   .test_instance_conforms_to_IAdapterRegistrationzGAdapterRegistrationTests.test_instance_conforms_to_IAdapterRegistrationn
  r  r   c                      G d d      } |       }| j                  |      \  }}}| j                  t        |      d|z         y )Nc                       e Zd ZdZ y):AdapterRegistrationTests.test___repr__.<locals>._Componentr  NrG   r&   r   r   r  rW  u
  r  r   r  zCAdapterRegistration(_REGISTRY, [IBar], IFoo, %r, TEST, 'DOCSTRING')r9   r   r  r  rS  r  rw   s         r   r<   z&AdapterRegistrationTests.test___repr__t
  sI    	 	\
#}}Z8Iub %'	(r   c                      G d d      } |       }| j                  |      \  }}}t               |_        | j                  t	        |      d|z         y )Nc                       e Zd Zd Zy)KAdapterRegistrationTests.test___repr___provided_wo_name.<locals>._Componentc                      yr  r&   r   s    r   r  zTAdapterRegistrationTests.test___repr___provided_wo_name.<locals>._Component.__repr__
  r  r   Nr  r&   r   r   r  r[  ~
  r  r   r  CAdapterRegistration(_REGISTRY, [IBar], None, %r, TEST, 'DOCSTRING')r  rX  s         r   r  z7AdapterRegistrationTests.test___repr___provided_wo_name}
  T    	 	  \
#}}Z8Iuhb %'	(r   c                      G d d      } |       }| j                  |      \  }}}t               |_        | j                  t	        |      d|z         y )Nc                       e Zd Zd Zy)LAdapterRegistrationTests.test___repr___component_wo_name.<locals>._Componentc                      yr  r&   r   s    r   r  zUAdapterRegistrationTests.test___repr___component_wo_name.<locals>._Component.__repr__
  r  r   Nr  r&   r   r   r  ra  
  r  r   r  r]  r  rX  s         r   r  z8AdapterRegistrationTests.test___repr___component_wo_name
  r^  r   c                     t               }| j                  |      \  }}}| j                  |j                         t	        |             y r   r  r   r  rS  r  rw   s        r   r  z&AdapterRegistrationTests.test___hash__
  r  r   c                 j    t               }| j                  |      \  }}}| j                  ||k(         y r   r  rd  s        r   r	  z-AdapterRegistrationTests.test___eq___identity
  r
  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k(         y r   r  r   r  rS  r  rw   ar2r  s          r   r  z(AdapterRegistrationTests.test___eq___hit
  r  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k(         y r   r  r   r  r  rS  r  rw   rh  r  s           r   r  z)AdapterRegistrationTests.test___eq___miss
  r  r   c                 j    t               }| j                  |      \  }}}| j                  ||k7         y r   r  rd  s        r   r  z-AdapterRegistrationTests.test___ne___identity
  r  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k7         y r   r  rg  s          r   r  z)AdapterRegistrationTests.test___ne___miss
  r  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k7         y r   r  rj  s           r   test___ne___hit_componentz2AdapterRegistrationTests.test___ne___hit_component
  r  r   c                     ddl m}  G d d|      } |d      }t               }| j                  |      \  }}}| j                  |      \  }}	}	||_        | j                  ||k7         y )Nr   rh   c                       e Zd Zy)?AdapterRegistrationTests.test___ne___hit_provided.<locals>.IFooNrG   r&   r   r   rJ   rq  
  rK   r   rJ   rE  )rS   rD   ra   r   rv   r+   )
r   rD   rJ   rN  r  rS  r  rw   rh  r  s
             r   test___ne___hit_providedz1AdapterRegistrationTests.test___ne___hit_provided
  sa    >	> 	F|X
#}}Z8IuMM*-	Qc	"r   c                     ddl m}  G d d|      } |d      }t               }t               }| j                  |      \  }}}| j                  |      \  }	}
}
|f|	_        | j                  ||	k7         y )Nr   rh   c                       e Zd Zy)?AdapterRegistrationTests.test___ne___hit_required.<locals>.IFooNrG   r&   r   r   rJ   ru  
  rK   r   rJ   rE  )rS   rD   ra   r   ri  r+   )r   rD   rJ   rN  r  r  rS  r  rw   rh  r  s              r   test___ne___hit_requiredz1AdapterRegistrationTests.test___ne___hit_required
  sj    >	> 	F|X
h#}}Z8IuMM+.	Qwc	"r   c                 j    t               }| j                  |      \  }}}| j                  ||k         y r   r  rd  s        r   r   z-AdapterRegistrationTests.test___lt___identity
  r!  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k         y r   r  rg  s          r   r#  z(AdapterRegistrationTests.test___lt___hit
  r$  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k         y r&  r(  rj  s           r   r)  z)AdapterRegistrationTests.test___lt___miss
  r*  r   c                 j    t               }| j                  |      \  }}}| j                  ||k         y r   r  rd  s        r   r,  z-AdapterRegistrationTests.test___le___identity
  r
  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||k         y r   r  rg  s          r   r.  z(AdapterRegistrationTests.test___le___hit
  r  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k         y r&  r(  rj  s           r   r0  z)AdapterRegistrationTests.test___le___miss
  r1  r   c                 j    t               }| j                  |      \  }}}| j                  ||kD         y r   r  rd  s        r   r3  z-AdapterRegistrationTests.test___gt___identity
  r!  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||kD         y r&  r(  rj  s           r   r5  z(AdapterRegistrationTests.test___gt___hit
  r6  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}| j                  ||kD         y r   r  rg  s          r   r8  z)AdapterRegistrationTests.test___gt___miss  r9  r   c                 j    t               }| j                  |      \  }}}| j                  ||k\         y r   r  rd  s        r   r;  z-AdapterRegistrationTests.test___ge___identity  r
  r   c                     t               }t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k\         y r&  r=  rj  s           r   r>  z)AdapterRegistrationTests.test___ge___miss  r?  r   c                     t               }| j                  |      \  }}}| j                  |      \  }}}|dz   |_        | j                  ||k\         y r&  r(  rg  s          r   rA  z(AdapterRegistrationTests.test___ge___hit  rB  r   r   )r)   rH   rI   r   r   rQ  rT  r<   r  r  r  r	  r  r  r  r  rn  rr  rv  r   r#  r)  r,  r.  r0  r3  r5  r8  r;  r>  rA  r&   r   r   rD  rD  P
  s    #&B
/(	(	(0
"
#$#
$#	#
#"
#""
##"
"#"
$#r   rD  c                   &    e Zd Zd ZddZd Zd Zy)SubscriptionRegistrationTestsc                     ddl m} |S )Nr   r  )rr   r  )r   r  s     r   r   z-SubscriptionRegistrationTests._getTargetClass#  s    D''r   Nc                     ddl m}  G d d|      } |d      } |d      } G d d      } |       }d}d	}	| j                         }
 |
||f||||	      ||fS )
Nr   rh   c                       e Zd Zy)4SubscriptionRegistrationTests._makeOne.<locals>.IFooNrG   r&   r   r   rJ   r  *  rK   r   rJ   r   c                       e Zd Zd Zy)9SubscriptionRegistrationTests._makeOne.<locals>._Registryc                      yr  r&   r   s    r   r  zBSubscriptionRegistrationTests._makeOne.<locals>._Registry.__repr__/  r  r   Nr  r&   r   r   r  r  .  r  r   r  r   r  r  rL  s              r   r   z&SubscriptionRegistrationTests._makeOne'  rM  r   c                 J    ddl m} ddlm}  ||| j	                                y )Nr   r   ISubscriptionAdapterRegistration)r  r  rq   r  r   )r   r  r  s      r   7test_class_conforms_to_ISubscriptionAdapterRegistrationzUSubscriptionRegistrationTests.test_class_conforms_to_ISubscriptionAdapterRegistration:  s    5N4d6J6J6LMr   c                 V    ddl m} ddlm} | j	                         \  }}} |||       y )Nr   r  r  )r  r  rq   r  r   )r   r  r  sarr  s        r   :test_instance_conforms_to_ISubscriptionAdapterRegistrationzXSubscriptionRegistrationTests.test_instance_conforms_to_ISubscriptionAdapterRegistration?  s$    6N]]_	Q5s;r   r   )r)   rH   rI   r   r   r  r  r&   r   r   r  r  !  s    (&N
<r   r  c                   8    e Zd Zd Zd	dZd Zd Zd Zd Zd Z	y)
HandlerRegistrationTestsc                     ddl m} |S )Nr   r5  )rr   r6  )r   r6  s     r   r   z(HandlerRegistrationTests._getTargetClassH  r  r   Nc                     ddl m}  G d d|      } |d      } G d d      } |       }d}d}| j                         }	 |	||f|||      ||fS )	Nr   rh   c                       e Zd Zy)/HandlerRegistrationTests._makeOne.<locals>.IFooNrG   r&   r   r   rJ   r  O  rK   r   rJ   c                       e Zd Zd Zy)4HandlerRegistrationTests._makeOne.<locals>._Registryc                      yr  r&   r   s    r   r  z=HandlerRegistrationTests._makeOne.<locals>._Registry.__repr__S  r  r   Nr  r&   r   r   r  r  R  r  r   r  r   r  r  )
r   r_   rD   rJ   rU   r  r   r   r  r  s
             r   r   z!HandlerRegistrationTests._makeOneL  sg    >	> 	F|	# 	# ;$$&hy#> 	r   c                 J    ddl m} ddlm}  ||| j	                                y )Nr   r  IHandlerRegistration)r  r  rq   r  r   )r   r  r  s      r   +test_class_conforms_to_IHandlerRegistrationzDHandlerRegistrationTests.test_class_conforms_to_IHandlerRegistration^  r  r   c                 V    ddl m} ddlm} | j	                         \  }}} |||       y )Nr   r  r  )r  r  rq   r  r   )r   r  r  hrr  s        r   .test_instance_conforms_to_IHandlerRegistrationzGHandlerRegistrationTests.test_instance_conforms_to_IHandlerRegistrationc  r  r   c                     d }| j                  |      \  }}}| j                  |j                  |u        | j                  |j                  |j                  u        | j                  |j                  d u        y )Nc                     t               r   rZ   rf  s    r   r\   z:HandlerRegistrationTests.test_properties.<locals>._factoryj  r]   r   )r   r+   handlerr`   rv   )r   r\   r  r  s       r   test_propertiesz(HandlerRegistrationTests.test_propertiesi  s^    	(MM(+Aq

h./

bjj01t+,r   c                      G d d      }| j                   |             \  }}}| j                  t        |      d|z         y )Nc                       e Zd ZdZ y)GHandlerRegistrationTests.test___repr___factory_w_name.<locals>._Factoryr  NrG   r&   r   r   rp  r  r  r  r   rp  =HandlerRegistration(_REGISTRY, [IFoo], %r, TEST, 'DOCSTRING')r9   r   rp  r  r  rw   s        r   test___repr___factory_w_namez5HandlerRegistrationTests.test___repr___factory_w_nameq  sD    	 	 $hj 9Iub %'	(r   c                      G d d      }| j                   |             \  }}}| j                  t        |      d|z         y )Nc                       e Zd Zd Zy)HHandlerRegistrationTests.test___repr___factory_wo_name.<locals>._Factoryc                      yr  r&   r   s    r   r  zQHandlerRegistrationTests.test___repr___factory_wo_name.<locals>._Factory.__repr__{  r  r   Nr  r&   r   r   rp  r  z  r  r   rp  r  r9   r  s        r   test___repr___factory_wo_namez6HandlerRegistrationTests.test___repr___factory_wo_namey  sF    	 	 !%hj 9Iub %'	(r   r   )
r)   rH   rI   r   r   r  r  r  r  r  r&   r   r   r  r  F  s&    #$B
/-((r   r  c                       e Zd Zd Zd Zy)PersistentAdapterRegistryc                     | j                   j                         }t        |      D ]3  }|| j                  v s|j	                  d      s#|j                  |       5 |j                  dd        |S )N_vro)__dict__copyr   
_delegated
startswithpop)r   stateks      r   __getstate__z&PersistentAdapterRegistry.__getstate__  s^    ""$e 	ADOO#q||D'9		!	 			$r   c                     |j                  dd      }| j                  j                  |       | j                          || _        | j
                  j                  |        y )Nr*   r&   )r  r  update_createLookupr*   r  r  )r   r  basess      r   __setstate__z&PersistentAdapterRegistry.__setstate__  sI    		+r*U#t$r   N)r)   rH   rI   r  r  r&   r   r   r  r    s    %r   r  c                       e Zd Zd Zy)PersistentComponentsc                 @    t               | _        t               | _        y r   )r  r-   r.   r   s    r   _init_registriesz%PersistentComponents._init_registries  s    1324r   N)r)   rH   rI   r  r&   r   r   r  r    s    5r   r  c                       e Zd Zy)PersistentDictComponentsNrG   r&   r   r   r  r    s    r   r  c                       e Zd Zd Zy)PersistentComponentsDictc                 Z    t         j                  |        t        j                  | |       y r   )r   r  r  )r   r   s     r   r  z!PersistentComponentsDict.__init__  s    d%%dD1r   Nr  r&   r   r   r  r    s    2r   r  c                   $    e Zd Zd Zd Zd Zd Zy)TestPersistentComponentsc                     t        d      S )Nr  )r  r   s    r   r   z!TestPersistentComponents._makeOne  s    #F++r   c                      y r   r&   r   mades     r   _check_equality_after_picklez5TestPersistentComponents._check_equality_after_pickle  s    r   c                     dd l }| j                         }|j                  |       |j                  |j                  |            }| j	                  |j
                  d       y Nr   r  )pickler   dumpsloadsr(   r)   )r   r  r3   comp2s       r   test_pickles_emptyz+TestPersistentComponents.test_pickles_empty  sG    }}TV\\$/00r   c                    dd l }| j                         }t               }|j                  |t               | j                  ||j                  t                     |j                  |j                  |            }| j                  |j                  d       | j                  |j                  t                     |j                  |t               | j                  ||j                  t                     | j                  |       y r  )r  r   ra   rT   r   r  r?  r  r  r(   r)   assertIsNotNoner  )r   r  r3   utilityr  s        r   &test_pickles_with_utility_registrationz?TestPersistentComponents.test_pickles_with_utility_registration  s    }}(	 	gooi0	2 V\\$/00 	U--i89 		 	g&&y1	3 	))%0r   N)r)   rH   rI   r   r  r  r  r&   r   r   r  r    s    ,11r   r  c                       e Zd Zd Zd Zd Zy)TestPersistentDictComponentsc                     t         S r   )r  r   s    r   r   z,TestPersistentDictComponents._getTargetClass      ''r   c                 >     | j                         d      }d|d<   |S )Nr  r  *   r$  r   r;   s     r   r   z%TestPersistentDictComponents._makeOne  s%    %t##%62Ur   c                 R    | j                  d|       | j                  |d   d       y )Nr$  r  )r  r(   r  s     r   r  z9TestPersistentDictComponents._check_equality_after_pickle  s$    eT"eb)r   N)r)   rH   rI   r   r   r  r&   r   r   r  r    s    (
*r   r  c                       e Zd Zd Zy)TestPersistentComponentsDictc                     t         S r   )r  r   s    r   r   z,TestPersistentComponentsDict._getTargetClass  r  r   N)r)   rH   rI   r   r&   r   r   r  r    s    (r   r  c                       e Zd Zd Zd Zd Zy)r    c                     || _         |D ci c]  }|t        ||       c}| _        |j                         D ]  \  }}t	        |||        y c c}w r   )modulegetattr
to_restoreitemssetattr)r   r  r   r$  values        r   r  z_Monkey.__init__  sR    @BC3 44C((* 	(JCFC'	( Ds   Ac                     | S r   r&   r   s    r   	__enter__z_Monkey.__enter__  s    r   c                 v    | j                   j                         D ]  \  }}t        | j                  ||        y r   )r  r  r  r  )r   exc_typeexc_valexc_tbr$  r  s         r   __exit__z_Monkey.__exit__  s2    ////1 	-JCDKKe,	-r   N)r)   rH   rI   r  r  r  r&   r   r   r    r      s    (-r   r    )r  unittestr   r   r'   r   rr   r   TestCaser	   r  r  rD  r  r  r  r  r   r  r  r  r  r  r    r&   r   r   <module>r     s      $ ; .o%Kh'' o%KdK w#x00 w#tN#x00 N#b"<H$5$5 "<J:(x00 :(x% 8 %"5: 5	3T 	
2t%9 2(1x00 (1V*#; *(#? (
- -r   