
    Vh-j                    
   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ  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ee      Z G d de      Z G d de      Z G d de      Z G d deeeej                        Z G d de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j                        Z G d' d(ej                        Z G d) d*      Zd+ Zd, Z G d- d.      Z G d/ d0ej                        Zy)1zTest Interface implementation
    N)CleanUp)MissingSomeAttrs)OptimizationTestMixin)SubclassableMixinc                       e Zd Zd Zd Zy)Test_invariantc                     ddl m} ddl m d  G fdd      }| j                  t	        ||d       dgi       y )Nr   TAGGED_DATA	invariantc                      t               NNotImplementedErrorargskws     S/home/dcms/DCMS/lib/python3.12/site-packages/zope/interface/tests/test_interface.py_checkz,Test_invariant.test_w_single.<locals>._check1       %''    c                   "    e Zd Z W W         y))Test_invariant.test_w_single.<locals>.FooN__name__
__module____qualname__)r   r   s   r   Foor   4   s    fr   r   
invariantszope.interface.interfacer   r   assertEqualgetattr)selfr   r   r   r   s      @@r   test_w_singlezTest_invariant.test_w_single-   s=    86	(	 	 	k48&1	3r   c                     ddl m} ddl m d d  G fdd      }| j                  t	        ||d       dgi       y )	Nr   r
   r   c                      t               r   r   r   s     r   r   z.Test_invariant.test_w_multiple.<locals>._check>   r   r   c                      t               r   r   r   s     r   _another_checkz6Test_invariant.test_w_multiple.<locals>._another_checkA   r   r   c                   6    e Zd Z W W         W W         y)+Test_invariant.test_w_multiple.<locals>.FooNr   )r*   r   r   s   r   r   r,   D   s    fn%r   r   r    r!   )r%   r   r   r*   r   r   s      @@@r   test_w_multiplezTest_invariant.test_w_multiple:   sF    86	(	(	& 	& 	k48&(@A	Cr   N)r   r   r   r&   r-    r   r   r   r   +   s    3Cr   r   c                       e Zd Zd Zd Zd Zy)Test_taggedValuec                 v    ddl m} ddl m  G fdd      }| j                  t	        ||d       ddgi       y )Nr   r
   taggedValuec                   $    e Zd Z W  ddg       y)+Test_taggedValue.test_w_single.<locals>.FoobarbazNr   r2   s   r   r   r5   R   s    w'r   r   r6   r7   r"   r   r3   r#   r$   r%   r   r   r3   s      @r   r&   zTest_taggedValue.test_w_singleN   s8    88	( 	( 	k48%)	+r   c                 x    ddl m} ddl m  G fdd      }| j                  t	        ||d       dgdd       y )	Nr   r
   r2   c                   8    e Zd Z W  ddg        W  dd       y)-Test_taggedValue.test_w_multiple.<locals>.Foor6   r7   quxspamNr   r2   s   r   r   r<   \   s    w'v&r   r   r7   r>   r6   r=   r8   r9   s      @r   r-   z Test_taggedValue.test_w_multipleX   s8    88	' 	' 	k48"'8	:r   c                 v    ddl m} ddl m  G fdd      }| j                  t	        ||d       ddd       y )	Nr   r
   r2   c                   L    e Zd Z W  ddg        W  dd        W  dd       y)9Test_taggedValue.test_w_multiple_overwriting.<locals>.Foor6   r7   r=   r>   frobNr   r2   s   r   r   rB   g   s#    w'v&v&r   r   rC   r>   r?   r8   r9   s      @r   test_w_multiple_overwritingz,Test_taggedValue.test_w_multiple_overwritingc   s6    88	' 	'
 	k48!'7	9r   N)r   r   r   r&   r-   rD   r.   r   r   r0   r0   L   s    +	:
9r   r0   c                   `    e Zd 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y)ElementTests	AnElementc                     ddl m} |S )Nr   )Element)r"   rI   )r%   rI   s     r   _getTargetClasszElementTests._getTargetClasst   s
    4r   Nc                 J    || j                   } | j                         |      S r   )DEFAULT_NAMErJ   )r%   names     r   _makeOnezElementTests._makeOnex   s(    <$$D%t##%d++r   c                    | j                         }| j                  |j                  | j                         | j                  |j	                         | j                         | j                  |j
                  d       | j                  |j                         d       | j                  t        |j                               g        y )N )	rN   r#   r   rL   getName__doc__getDoclistgetTaggedValueTagsr%   elements     r   test_ctor_defaultszElementTests.test_ctor_defaults}   s    --/))4+<+<=*D,=,=>"-)2.g88:;R@r   c                     | j                  d      }| j                  |j                  d        | j                  |j                  d       y )Nz
An Element)rN   r#   r   rR   rV   s     r   test_ctor_no_doc_space_in_namez+ElementTests.test_ctor_no_doc_space_in_name   s:    ---))40,7r   c                 f    | j                         }| j                  t        |j                  d       y Nnonesuch)rN   assertRaisesKeyErrorgetTaggedValuerV   s     r   test_getTaggedValue_missz%ElementTests.test_getTaggedValue_miss   s%    --/(G$:$:JGr   c                     | j                         }| j                  g t        |j                                      |j	                  dd       | j                  dgt        |j                                      y Nfoor6   )rN   r#   rT   getDirectTaggedValueTagssetTaggedValuerV   s     r   test_getDirectTaggedValueTagsz*ElementTests.test_getDirectTaggedValueTags   s[    --/T'"B"B"DEFue,%$w'G'G'I"JKr   c                 f    | j                         }| j                  |j                  d      d        y r\   rN   r#   queryTaggedValuerV   s     r   test_queryTaggedValue_missz'ElementTests.test_queryTaggedValue_miss   s(    --/11*=tDr   c                 h    | j                         }| j                  |j                  dd      d       y Nr]   r6   ri   rV   s     r   $test_queryTaggedValue_miss_w_defaultz1ElementTests.test_queryTaggedValue_miss_w_default   s*    --/11*eDeLr   c                 f    | j                         }| j                  t        |j                  d       y r\   )rN   r^   r_   getDirectTaggedValuerV   s     r   test_getDirectTaggedValue_missz+ElementTests.test_getDirectTaggedValue_miss   s%    --/(G$@$@*Mr   c                 f    | j                         }| j                  |j                  d      d        y r\   rN   r#   queryDirectTaggedValuerV   s     r    test_queryDirectTaggedValue_missz-ElementTests.test_queryDirectTaggedValue_miss   s(    --/77
CTJr   c                 h    | j                         }| j                  |j                  dd      d       y rm   rs   rV   s     r   *test_queryDirectTaggedValue_miss_w_defaultz7ElementTests.test_queryDirectTaggedValue_miss_w_default   s-    --/**:u=u	
r   c                     | j                         }|j                  dd       | j                  t        |j	                               dg       | j                  |j                  d      d       | j                  |j                  d      d       y rc   )rN   rf   r#   rT   rU   r`   rj   rV   s     r   test_setTaggedValuez ElementTests.test_setTaggedValue   ss    --/ue,g88:;eWE//6>11%8%@r   c                 N    ddl m} ddlm} | j	                         } |||       y )Nr   )IElementverifyObject)zope.interface.interfacesr{   zope.interface.verifyr}   rN   )r%   r{   r}   rW   s       r   test_verifieszElementTests.test_verifies   s    66--/Xw'r   r   )r   r   r   rL   rJ   rN   rX   rZ   ra   rg   rk   rn   rq   ru   rw   ry   r   r.   r   r   rF   rF   p   sP    L,
A8
HLEMNK
A(r   rF   c                   (    e Zd Zd ZeZd Zd Zd Zy)GenericSpecificationBaseTestsc                     ddl m} |S )Nr   )SpecificationBasePy)r"   r   )r%   r   s     r   _getFallbackClassz/GenericSpecificationBaseTests._getFallbackClass   s    @""r   c                 ,     | j                                S r   rJ   r%   s    r   rN   z&GenericSpecificationBaseTests._makeOne   s    %t##%''r   c                     ddl m} ddlm | j	                         }fd}t        ||      5  | j                  |j                  t                            d d d        y # 1 sw Y   y xY w)Nr   	interface_emptyc                     S r   r.   objr   s    r   _providedByzGGenericSpecificationBaseTests.test_providedBy_miss.<locals>._providedBy       Mr   
providedBy)	zope.interfacer   zope.interface.declarationsr   rN   _MonkeyassertFalser   object)r%   r   sbr   r   s       @r   test_providedBy_missz2GenericSpecificationBaseTests.test_providedBy_miss   sS    ,6]]_	 Y;7 	6R]]6845	6 	6 	6   )A""A+c                     ddl m} ddlm | j	                         }fd}t        ||      5  | j                  |j                  t                            d d d        y # 1 sw Y   y xY w)Nr   r   r   c                     S r   r.   r   s    r   _implementedByzMGenericSpecificationBaseTests.test_implementedBy_miss.<locals>._implementedBy   r   r   implementedBy)	r   r   r   r   rN   r   r   r   r   )r%   r   r   r   r   s       @r   test_implementedBy_missz5GenericSpecificationBaseTests.test_implementedBy_miss   sU    ,6]]_	 Yn= 	9R--fh78	9 	9 	9r   N)r   r   r   r   rJ   rN   r   r   r.   r   r   r   r      s    # (O(	6	9r   r   c                       e Zd Zd Zy)SpecificationBaseTestsc                     ddl m} |S )Nr   )SpecificationBase)r"   r   )r%   r   s     r   rJ   z&SpecificationBaseTests._getTargetClass   s    >  r   Nr   r   r   rJ   r.   r   r   r   r      s    !r   r   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)SpecificationBasePyTestsc                     | j                         }i |_        | j                  |j                  t	                            y r   rN   _impliedr   isOrExtendsr   r%   r   s     r   test___call___missz+SpecificationBasePyTests.test___call___miss   -    ]]_12r   c                 x    | j                         }t               }|i i|_        | j                   ||             y r   rN   r   r   
assertTruer%   r   testings      r   test___call___hitz*SpecificationBasePyTests.test___call___hit   /    ]]_(m7$r   c                     | j                         }i |_        | j                  |j                  t	                            y r   r   r   s     r   test_isOrExtends_missz.SpecificationBasePyTests.test_isOrExtends_miss   r   r   c                 x    | j                         }t               }|i i|_        | j                   ||             y r   r   r   s      r   test_isOrExtends_hitz-SpecificationBasePyTests.test_isOrExtends_hit   r   r   c                     ddl m} | j                          G fdd      fd}t        ||      5  | j	                  j                  t                            d d d        y # 1 sw Y   y xY w)Nr   r   c                       e Zd ZW  i iZy)>SpecificationBasePyTests.test_implementedBy_hit.<locals>._DeclNr   r   r   r   r   s   r   _Declr         BxHr   r   c                             S r   r.   r   r   s    r   r   zGSpecificationBasePyTests.test_implementedBy_hit.<locals>._implementedBy  
    7Nr   r   )r   r   rN   r   r   r   r   )r%   r   r   r   r   s      @@r   test_implementedBy_hitz/SpecificationBasePyTests.test_implementedBy_hit  sZ    ,]]_	  	 	 Yn= 	8OOB,,VX67	8 	8 	8   )A))A2c                     ddl m} | j                          G fdd      fd}t        ||      5  | j	                  j                  t                            d d d        y # 1 sw Y   y xY w)Nr   r   c                       e Zd ZW  i iZy);SpecificationBasePyTests.test_providedBy_hit.<locals>._DeclNr   r   s   r   r   r     r   r   r   c                             S r   r.   r   s    r   r   zASpecificationBasePyTests.test_providedBy_hit.<locals>._providedBy  r   r   r   )r   r   rN   r   r   r   r   )r%   r   r   r   r   s      @@r   test_providedBy_hitz,SpecificationBasePyTests.test_providedBy_hit  sX    ,]]_	  	 	 Y;7 	5OOBMM&(34	5 	5 	5r   N)	r   r   r   r   r   r   r   r   r   r.   r   r   r   r      s     3
%3
%85r   r   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)!NameAndModuleComparisonTestsMixinc                 &    | j                  dd      S )Nab)rN   r   s    r   _makeOneToComparez3NameAndModuleComparisonTestsMixin._makeOneToCompare  s    }}S#&&r   c                    dd l }| j                         }t        ||      }t        |d|z        } G fdd       G d d      } G d d      }| j                   |       j                  d	       | j                   |       j
                  d	       | j                  t              5  t         |       d
       d d d        | j                  t              5  t         |       d       d d d        ||fD ]#  }| j                   | |             t               %  G d d      }	| j                   || |	                    | j                   | |	             t                G d d      }
| j                   | |
             t               | j                  t              5   || |
              d d d         G d dt              }|_        | j                  |      5  t         |       d
       d d d        | j                  |      5  t         |       d       d d d        ||fD ]Q  }| j                  |      5   || |              d d d        | j                  |      5   | |              d d d        S y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   qxY w# 1 sw Y   xY w)Nr   z__%s__c                       e Zd ZeZ fdZy)aNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnMissingc                 t    	 t         j                  | |      S # t        $ r j                  } ||      w xY wr   )r   __getattribute__AttributeErrorExc)r%   rM   excRaisesErrorOnMissings      r   r   zrNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnMissing.__getattribute__0  s>    $!224>>% $.22Cd)O$s    7N)r   r   r   r   r   r   )r   s   r   r   r   -  s     C$r   r   c                   "    e Zd Zd Zed        Zy)`NameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnModulec                     d| _         y Nrd   )r   r   s    r   __init__ziNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnModule.__init__8  s	     %r   c                     t         r   )r   r   s    r   r   zkNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnModule.__module__;  s    $$r   N)r   r   r   r   propertyr.   r   r   RaisesErrorOnModuler   7  s    & % %r   r   c                       e Zd Zd Zy)^NameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnNamec                     d| _         y r   r   r   s    r   r   zgNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnName.__init__@  s	    "'r   Nr   r   r   r   r.   r   r   RaisesErrorOnNamer   ?  s    (r   r   rd   r   r   c                   &    e Zd Zd ZeZeZeZeZeZy)`NameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.AllowsAnyComparisonc                      yNTr.   )r%   others     r   __eq__zgNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.AllowsAnyComparison.__eq__Q      r   N	r   r   r   r   __lt____le____gt____ge____ne__r.   r   r   AllowsAnyComparisonr   P  s     FFFFFr   r   c                   $    e Zd ZdZeZeZeZeZeZy)_NameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.AllowsNoComparisonNr   r.   r   r   AllowsNoComparisonr   ]  s     FFFFFFr   r   c                       e Zd Zy)XNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.MyExceptionNr   r.   r   r   MyExceptionr   j      r   r   )operatorr   r$   r#   r   r   r^   r   assertIsNotImplementedr   	TypeError	Exceptionr   )r%   rM   r   ibopmethr   r   clsr   r   r   r   s               @r   !__check_NotImplemented_comparisonzCNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison!  s    	##%Xt$r8d?+
	$ 	$	%"6 	%	( 4 	( 	,.77?*,77?~. 	9')<8	9~. 	5%'4	5 '(99 	7CMM$su+~6	7	"6 	 	22456d.01>B	 	 	d-/0.Ay) 	)r%'(	)	) 	 $/ {+ 	9')<8	9{+ 	5%'4	5 '(99 	C"";/ 2su"";/ SU 	_	9 	9	5 	5>	) 	)	9 	9	5 	5  sT   *JJ&J$J(J4K )KJJJ%(J14J= K		K	c                 &    | j                  d       y )NltC_NameAndModuleComparisonTestsMixin__check_NotImplemented_comparisonr   s    r   test__lt__NotImplementedz:NameAndModuleComparisonTestsMixin.test__lt__NotImplementedz      ..t4r   c                 &    | j                  d       y )Nler  r   s    r   test__le__NotImplementedz:NameAndModuleComparisonTestsMixin.test__le__NotImplemented}  r  r   c                 &    | j                  d       y )Ngtr  r   s    r   test__gt__NotImplementedz:NameAndModuleComparisonTestsMixin.test__gt__NotImplemented  r  r   c                 &    | j                  d       y )Nger  r   s    r   test__ge__NotImplementedz:NameAndModuleComparisonTestsMixin.test__ge__NotImplemented  r  r   N)	r   r   r   r   r  r  r  r  r  r.   r   r   r   r     s"    'Wr5555r   r   c                   8    e Zd Zd Zd Zd	dZd Zd Zd Zd Z	y)
InterfaceBaseTestsMixinc                     t         r   r   r   s    r   rJ   z'InterfaceBaseTestsMixin._getTargetClass  s    !!r   c                     ddl m} |S )Nr   )InterfaceBasePy)r"   r  )r%   r  s     r   r   z)InterfaceBaseTestsMixin._getFallbackClass  s    <r   Nc                 L     G fdd| j                               } |||      S )Nc                       e Zd Zd Z fdZy),InterfaceBaseTestsMixin._makeOne.<locals>.IBc                      ||       S r   r.   )r%   conforms     r   _call_conformz:InterfaceBaseTestsMixin._makeOne.<locals>.IB._call_conform  s    t}$r   c                     S r   r.   )r%   r   object_should_provides     r   r   z7InterfaceBaseTestsMixin._makeOne.<locals>.IB.providedBy  s	    ,,r   N)r   r   r   r"  r   )r$  s   r   IBr    s    %-r   r%  r   )r%   r$  rM   moduler%  s    `   r   rN   z InterfaceBaseTestsMixin._makeOne  s'    	-%%' 	- $r   c                     | j                  d      }t                G fdd      }| j                   | |                    y )NFc                       e Zd Z fdZy)UInterfaceBaseTestsMixin.test___call___w___conform___returning_value.<locals>._Adaptedc                     S r   r.   )r%   iface	conformeds     r   __conform__zaInterfaceBaseTestsMixin.test___call___w___conform___returning_value.<locals>._Adapted.__conform__  s	      r   Nr   r   r   r-  )r,  s   r   _Adaptedr)    s    !r   r/  )rN   r   r   )r%   r  r/  r,  s      @r   +test___call___w___conform___returning_valuezCInterfaceBaseTestsMixin.test___call___w___conform___returning_value  s8    ]]5!H		! 	! 	bni0r   c                     | j                  d      }|| j                         f}t               }t               }| j                   |||      |       y )NF)rN   rJ   r   r   )r%   r  __traceback_info__adapted	alternates        r   7test___call___wo___conform___ob_no_provides_w_alternatezOInterfaceBaseTestsMixin.test___call___wo___conform___ob_no_provides_w_alternate  sG    ]]5!!5!5!77(H	b),i8r   c                     | j                  d      }| j                  t              5 } |t                      d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)NFzCould not adapt)rN   r^   r  r   assertInstr	exception)r%   r  r   s      r   7test___call___w___conform___ob_no_provides_wo_alternatezOInterfaceBaseTestsMixin.test___call___w___conform___ob_no_provides_wo_alternate  sX    ]]5!y) 	SvxL	 	'S]]);<	 	s   A&&A/c                 P    t        j                  | | j                         d       y )Nr-  )expected_missing)r   test_raisesrN   r   s    r   6test___call___w_no_conform_catches_only_AttributeErrorzNInterfaceBaseTestsMixin.test___call___w_no_conform_catches_only_AttributeError  s    $$$--/M	
r   )FNN)
r   r   r   rJ   r   rN   r0  r5  r:  r>  r.   r   r   r  r    s%    "
	 19=
r   r  c                       e Zd Zd Zy)InterfaceBaseTestsc                     ddl m} |S )Nr   )InterfaceBase)r"   rB  )r%   rB  s     r   rJ   z"InterfaceBaseTests._getTargetClass      :r   Nr   r.   r   r   r@  r@    s    r   r@  c                   6    e Zd Zej                  Zd Zd Zd Zy)InterfaceBasePyTestsc                 x    | j                  d      } G d d      } |       }| j                   ||      |       y )NTc                       e Zd Zd Zy)SInterfaceBasePyTests.test___call___w___conform___miss_ob_provides.<locals>._Adaptedc                      y r   r.   r%   r+  s     r   r-  z_InterfaceBasePyTests.test___call___w___conform___miss_ob_provides.<locals>._Adapted.__conform__  r   r   Nr.  r.   r   r   r/  rH        r   r/  )rN   r   )r%   r  r/  r3  s       r   ,test___call___w___conform___miss_ob_provideszAInterfaceBasePyTests.test___call___w___conform___miss_ob_provides  s5    ]]4 	 	 *bk7+r   c                 |    | j                  d      }t               }| j                  |j                  |      |       y r   )rN   r   r   	__adapt__)r%   r  r3  s      r   test___adapt___ob_providesz/InterfaceBasePyTests.test___adapt___ob_provides  s.    ]]4 (bll7+W5r   c                    ddl m} | j                  d      }t               }g fd}d }t	        |||g      5  | j                  |j                  |      |       | j                  ||fg       d d d        y # 1 sw Y   y xY w)Nr   r   Fc                 ,    j                  | |f       y r   append)r+  r   _misseds     r   
_hook_misszQInterfaceBasePyTests.test___adapt___ob_no_provides_uses_hooks.<locals>._hook_miss  s    NNE3<(r   c                     |S r   r.   r+  r   s     r   	_hook_hitzPInterfaceBasePyTests.test___adapt___ob_no_provides_uses_hooks.<locals>._hook_hit  s    Jr   adapter_hooks)r   r   rN   r   r   r   rN  r#   )r%   r   r  r3  rU  rX  rT  s         @r   (test___adapt___ob_no_provides_uses_hooksz=InterfaceBasePyTests.test___adapt___ob_no_provides_uses_hooks  s}    ,]]5!(	)	 Yz9.EF 	7MM",,w/9WG}o6	7 	7 	7s   7A<<BN)	r   r   r   r  r   rJ   rL  rO  r[  r.   r   r   rE  rE    s     .??O,6
7r   rE  c                   p    e Zd Zd Zef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)SpecificationTestsc                     ddl m} |S )Nr   )Specification)r"   r_  )r%   r_  s     r   rJ   z"SpecificationTests._getTargetClass  rC  r   c                 h    |t         u r | j                                S  | j                         |      S r   )_markerrJ   )r%   basess     r   rN   zSpecificationTests._makeOne  s4    G)4'')++%t##%e,,r   c                 l   ddl m} | j                         }| j                  |j                  d       | j                  t        |j                        d       | j                  ||j                         | j                  ||j                         | j                  t        |j                        d       y )Nr   	Interfacer.      )	r"   re  rN   r#   	__bases__lenr   r7  
dependents)r%   re  specs      r   	test_ctorzSpecificationTests.test_ctor  sz    6}},T]]+Q/dDMM*i/T__-q1r   c                     | j                         }t               }|j                  |       | j                  t	        |j
                        d       | j                  |j
                  |   d       y N   )rN   DummyDependent	subscriber#   rh  ri  r%   rj  deps      r   test_subscribe_first_timez,SpecificationTests.test_subscribe_first_time   sS    }}sT__-q1-q1r   c                     | j                         }t               }|j                  |       |j                  |       | j                  |j                  |   d       y )Nrf  )rN   ro  rp  r#   ri  rq  s      r   test_subscribe_againz'SpecificationTests.test_subscribe_again  sF    }}ss-q1r   c                 z    | j                         }t               }| j                  t        |j                  |       y r   )rN   ro  r^   r_   unsubscriberq  s      r   test_unsubscribe_missz(SpecificationTests.test_unsubscribe_miss  s-    }}(D$4$4c:r   c                 6   | j                         }t               }|j                  |       |j                  |       |j                  |       | j	                  |j
                  |   d       |j                  |       | j                  ||j
                         y rm  )rN   ro  rp  rw  r#   ri  assertNotInrq  s      r   test_unsubscribez#SpecificationTests.test_unsubscribe  sv    }}ss-q1doo.r   c                    ddl m} | j                         }t               }|j	                  |        G d d|      } G d d|      }|f|_        | j                  |j                  |g       | j                  |j                  |   d       |f|_        | j                  |j                  j                  |      d        | j                  |j                  |   d       y )Nr   rd  c                       e Zd Zy)YSpecificationTests.test___setBases_subscribes_bases_and_notifies_dependents.<locals>.IFooNr   r.   r   r   IFoor~  #  r   r   r  c                       e Zd Zy)YSpecificationTests.test___setBases_subscribes_bases_and_notifies_dependents.<locals>.IBarNr   r.   r   r   IBarr  &  r   r   r  rn  )
r"   re  rN   ro  rp  rg  r#   _changedri  get)r%   re  rj  rr  r  r  s         r   8test___setBases_subscribes_bases_and_notifies_dependentszKSpecificationTests.test___setBases_subscribes_bases_and_notifies_dependents  s    6}}s	9 		9 	 v..2,,T2D9.2r   c                    ddl m}  G d d|      }| j                         }d|_        d|j                  |<   |j                  |       | j                  |j                         | j                  ||j                         y )Nr   rd  c                       e Zd Zy)JSpecificationTests.test_changed_clears_volatiles_and_implied.<locals>.IFooNr   r.   r   r   r  r  3  r   r   r  r   r.   )r"   re  rN   _v_attrsr   changedassertIsNonerz  r%   re  r  rj  s       r   )test_changed_clears_volatiles_and_impliedz<SpecificationTests.test_changed_clears_volatiles_and_implied0  se    6	9 	 }} dT$--(t}}-r   c                     ddl m}  G d d|      }| j                  ||g      }| j                  t	        |j                               |g       y )Nr   rd  c                       e Zd Zy)CSpecificationTests.test_interfaces_skips_already_seen.<locals>.IFooNr   r.   r   r   r  r  @  r   r   r  )r"   re  rN   r#   rT   
interfacesr  s       r   "test_interfaces_skips_already_seenz5SpecificationTests.test_interfaces_skips_already_seen=  sC    6	9 	 }}dD\*doo/04&9r   c                     ddl m}  G d d|      }| j                  |      }| j                  |j	                  |d             y )Nr   rd  c                       e Zd Zy)<SpecificationTests.test_extends_strict_wo_self.<locals>.IFooNr   r.   r   r   r  r  I  r   r   r  Tstrict)r"   re  rN   r   extendsr  s       r   test_extends_strict_wo_selfz.SpecificationTests.test_extends_strict_wo_selfF  s<    6	9 	 }}T"d489r   c                 h    | j                         }| j                  |j                  |d             y )NTr  )rN   r   r  r%   rj  s     r   test_extends_strict_w_selfz-SpecificationTests.test_extends_strict_w_selfO  s(    }}d489r   c                 h    | j                         }| j                  |j                  |d             y )NFr  )rN   r   r  r  s     r   test_extends_non_strict_w_selfz1SpecificationTests.test_extends_non_strict_w_selfS  s&    }}T%89r   c                     | j                         }t               }d|i|_        | j                  |j	                  d      |       y r   )rN   r   r  r   r  )r%   rj  rd   s      r   test_get_hit_w__v_attrsz*SpecificationTests.test_get_hit_w__v_attrsW  s5    }}hdhhuos+r   c                 8   ddl m ddl m}  G fdd|      } G fdd|      }| j                  ||g      }| j	                  |j                  d      |j                  d             | j	                  |j                  d	      |j                  d	             y )
Nr   	Attributerd  c                        e Zd Z W  d      Zy)CSpecificationTests.test_get_hit_from_base_wo__v_attrs.<locals>.IFoord   N)r   r   r   rd   r  s   r   r  r  a      E"Cr   r  c                        e Zd Z W  d      Zy)CSpecificationTests.test_get_hit_from_base_wo__v_attrs.<locals>.IBarr6   Nr   r   r   r6   r  s   r   r  r  d  r  r   r  rd   r6   )r"   r  re  rN   r   r  )r%   re  r  r  rj  r  s        @r   "test_get_hit_from_base_wo__v_attrsz5SpecificationTests.test_get_hit_from_base_wo__v_attrs]  sq    66	#9 	#	#9 	# }}dD\*dhhuotxx7dhhuotxx7r   c           
      H   ddl m} 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||      }	| j                   ||	      j                   ||	       ||      | ||       |t              |f       y )Nr   r   implementerrd  c                       e Zd Zy)TSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.IDefaultViewNameNr   r.   r   r   IDefaultViewNamer  u  r   r   r  c                       e Zd Zy)KSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.ContextNr   r.   r   r   Contextr  x  r   r   r  c                       e Zd Zy)LSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.RDBModelNr   r.   r   r   RDBModelr  {  r   r   r  c                       e Zd Zy)JSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.IOtherNr   r.   r   r   IOtherr  ~  r   r   r  c                       e Zd Zy)MSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.OtherBaseNr   r.   r   r   	OtherBaser        r   r  c                       e Zd Zy)ISpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.ModelNr   r.   r   r   Modelr    r   r   r  )r   r   r  r"   re  r#   __sro__r   )
r%   r   r  re  r  r  r  r  r  r  s
             r   'test_multiple_inheritance_no_interfacesz:SpecificationTests.test_multiple_inheritance_no_interfacesk  s     	>;6	y 		 		w 		Y 	 
V		 	 
		Iw 	 	% ((e$i(g&f%
	
r   N)r   r   r   rJ   ra  rN   rk  rs  ru  rx  r{  r  r  r  r  r  r  r  r  r  r.   r   r   r]  r]    sW     % -
222;
/3&.::::,8'
r   r]  c                   8   e Zd Zd Z	 	 d3d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/ Z0d0 Z1d1 Z2d2 Z3y)4InterfaceClassTestsc                     ddl m} |S )Nr   InterfaceClass)r"   r  )r%   r  s     r   rJ   z#InterfaceClassTests._getTargetClass  s    ;r   Nc                 6     | j                         |||||      S r   r   )r%   rM   rb  attrsrR   r   s         r   rN   zInterfaceClassTests._makeOne  s     %t##%dE5':NNr   c                    | j                         } |d      }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                         d       y )NITestingrP   r.   )rJ   r#   r   rR   rg  getBases)r%   klassinsts      r   rX   z&InterfaceClassTests.test_ctor_defaults  sl    $$&Z 
3r*,"-r   c                 f    | j                         }| j                  t        |dt               f       y )Nr  )rJ   r^   r  r   )r%   r  s     r   test_ctor_bad_basesz'InterfaceClassTests.test_ctor_bad_bases  s(    $$&)UJDr   c                 ~   ddl m} ddl m} d } |dd       ||      d}| j                         } |d|	      }| j	                  |j
                  d       | j	                  |j                  d       | j	                  |j                  d
       | j	                  |j                         |j                                y )Nr   r  fromFunctionc                       y	DOCSTRINGNr.   r.   r   r   _barzBInterfaceClassTests.test_ctor_w_attrs_attrib_methods.<locals>._bar      r   r   rP   rd   r6   r  r  r.   )
r"   r  r  rJ   r#   r   rR   rg  nameskeys)r%   r  r  r  ATTRSr  r  s          r    test_ctor_w_attrs_attrib_methodsz4InterfaceClassTests.test_ctor_w_attrs_attrib_methods  s    69	 UB'%
 $$&Zu-
3r*,uzz|4r   c                 :   di i}| j                         } |d|      }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  t        |j                               g        y )N
__locals__r  r  rP   r.   rJ   r#   r   rR   rg  rT   r  r%   r  r  r  s       r   test_ctor_attrs_w___locals__z0InterfaceClassTests.test_ctor_attrs_w___locals__  s}    r"$$&Zu-
3r*,djjl+R0r   c                 :   di i}| j                         } |d|      }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  t        |j                               g        y )N__annotations__r  r  rP   r.   r  r  s       r   !test_ctor_attrs_w___annotations__z5InterfaceClassTests.test_ctor_attrs_w___annotations__  s}    "B'$$&Zu-
3r*,djjl+R0r   c                 F   ddl m} d|i}| j                         } |d|      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  t        |j                               g        y )Nr   )_decorator_non_returndropmer  r  rP   r.   )	r"   r  rJ   r#   r   rR   rg  rT   r  )r%   r  r  r  r  s        r   'test_ctor_attrs_w__decorator_non_returnz;InterfaceClassTests.test_ctor_attrs_w__decorator_non_return  s    B01$$&Zu-
3r*,djjl+R0r   c                 r    ddl m} dt               i}| j                         }| j	                  ||d|       y )Nr   )InvalidInterfaceinvalidr  r  )zope.interface.exceptionsr  r   rJ   r^   )r%   r  r  r  s       r   #test_ctor_attrs_w_invalid_attr_typez7InterfaceClassTests.test_ctor_attrs_w_invalid_attr_type  s7    >FH%$$&*E:UKr   c                 z    ddi}| j                         } |d|d      }| j                  |j                  d       y )NrR   ATTRr  EXPLICIT)r  rR   )rJ   r#   rR   r  s       r   test_ctor_w_explicit___doc__z0InterfaceClassTests.test_ctor_w_explicit___doc__  s<    F#$$&ZujAz2r   c                 x    | j                         }| j                  t        |j                               |g       y r   )rN   r#   rT   r  rJ  s     r   test_interfacesz#InterfaceClassTests.test_interfaces  s-    e..01E7;r   c                     | j                         }| j                  d|f      }| j                  |j                         |f       y NISub)rb  )rN   r#   r  r%   r+  subs      r   test_getBasesz!InterfaceClassTests.test_getBases  s9    mmF5(m3%2r   c                 d    | j                         }| j                  |j                  |             y r   )rN   r   isEqualOrExtendedByrJ  s     r   !test_isEqualOrExtendedBy_identityz5InterfaceClassTests.test_isEqualOrExtendedBy_identity  s$    11%89r   c                     | j                         }| j                  d|f      }| j                  |j                  |             | j                  |j                  |             y r  )rN   r   r  r   r  s      r   !test_isEqualOrExtendedBy_subifacez5InterfaceClassTests.test_isEqualOrExtendedBy_subiface  sQ    mmF5(m311#670078r   c                     | j                  d      }| j                  d      }| j                  |j                  |             | j                  |j                  |             y )NOneAnother)rN   r   r  )r%   oneanothers      r   "test_isEqualOrExtendedBy_unrelatedz6InterfaceClassTests.test_isEqualOrExtendedBy_unrelated  sP    mmE"--	*009:44S9:r   c                    ddl m} ddl m} d } |dd       ||      d}d |d	d      i}| j                  d
|      }| j                  d|f|      }| j	                  t        |j                  d            dg       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zFInterfaceClassTests.test_names_w_all_False_ignores_bases.<locals>._bar  r  r   r   rP   r  r7   BazIBaser  IDerivedrb  r  Fallr"   r  r  rN   r#   sortedr  r%   r  r  r  
BASE_ATTRSDERIVED_ATTRSbasederiveds           r   $test_names_w_all_False_ignores_basesz8InterfaceClassTests.test_names_w_all_False_ignores_bases  s    69	 UB'%


 9UB'
 }}WJ}7--
4'-O% 89E7Cr   c                     ddl m} ddl m} d } |dd       ||      d}| j                  |      }| j	                  t        |j                  d	
            ddg       y )Nr   r  r  c                       yr  r.   r.   r   r   r  z@InterfaceClassTests.test_names_w_all_True_no_bases.<locals>._bar  r  r   r   rP   r  r  Tr  r6   rd   r  r%   r  r  r  r  r  s         r   test_names_w_all_True_no_basesz2InterfaceClassTests.test_names_w_all_True_no_bases  s^    69	 UB'%
 mm%m(		d	 34uenEr   c                    ddl m} ddl m} d } |dd       ||      d}d |d	d      i}| j                  d
|      }| j                  d|f|      }| j	                  t        |j                  d            g d       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zFInterfaceClassTests.test_names_w_all_True_w_bases_simple.<locals>._bar"  r  r   r   rP   r  r7   r	  r
  r  r  r  Tr  r6   r7   rd   r  r  s           r   $test_names_w_all_True_w_bases_simplez8InterfaceClassTests.test_names_w_all_True_w_bases_simple  s    69	 UB'%


 9UB'
 }}WJ}7--
4'-O7==T=*+-B	
r   c                    ddl m} ddl m} d }d } |dd       ||      d} ||       |d	d      d
}| j                  d|      }| j                  d|f|      }| j	                  t        |j                  d            g d       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zJInterfaceClassTests.test_names_w_all_True_bases_w_same_names.<locals>._bar6  r  r   c                       yr  r.   r.   r   r   _foozJInterfaceClassTests.test_names_w_all_True_bases_w_same_names.<locals>._foo9  r  r   r   rP   r  r	  rd   r7   r
  r  r  r  Tr  r  r  	r%   r  r  r  r"  r  r  r  r  s	            r   (test_names_w_all_True_bases_w_same_namesz<InterfaceClassTests.test_names_w_all_True_bases_w_same_names2  s    69		 UB'%


  %UB'
 }}WJ}7--
4'-OMMdM#%&;	
r   c                     ddl m} ddl m} d }d } |dd       ||      d} ||       |d	d      d
}| j                  d|      }| j                  d|f|      }| j	                  t        |      g d       y )Nr   r  r  c                       yr  r.   r.   r   r   r  z/InterfaceClassTests.test___iter__.<locals>._barN  r  r   c                       yr  r.   r.   r   r   r"  z/InterfaceClassTests.test___iter__.<locals>._fooQ  r  r   r   rP   r  r	  r#  r
  r  r  r  r  )r"   r  r  rN   r#   r  r$  s	            r   test___iter__z!InterfaceClassTests.test___iter__J  s    69		 UB'%


  %UB'
 }}WJ}7--
4'-O*?@r   c                    ddl m} ddl m} d } |dd       ||      d}d |d	d      i}| j                  d
|      }| j                  d|f|      }| j	                  t        |j                  d            d|d   fg       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zUInterfaceClassTests.test_namesAndDescriptions_w_all_False_ignores_bases.<locals>._bard  r  r   r   rP   r  r7   r	  r
  r  r  r  Fr  r"   r  r  rN   r#   r  namesAndDescriptionsr  s           r   3test_namesAndDescriptions_w_all_False_ignores_baseszGInterfaceClassTests.test_namesAndDescriptions_w_all_False_ignores_bases`  s    69	 UB'%


 9UB'
 }}WJ}7--
4'-O7//E/:;e,->	
r   c                     ddl m} ddl m} d } |dd       ||      d}| j                  |      }| j	                  t        |j                  d	
            d|d   fd|d   fg       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zOInterfaceClassTests.test_namesAndDescriptions_w_all_True_no_bases.<locals>._barz  r  r   r   rP   r  r  Fr  r6   rd   r,  r  s         r   -test_namesAndDescriptions_w_all_True_no_baseszAInterfaceClassTests.test_namesAndDescriptions_w_all_True_no_basesv  s{    69	 UB'%
 mm%m(3+++67e%e%:	
r   c                 &   ddl m} ddl m} d } |dd       ||      d}d |d	d      i}| j                  d
|      }| j                  d|f|      }| j	                  t        |j                  d            d|d   fd|d   fd|d   fg       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zMInterfaceClassTests.test_namesAndDescriptions_w_all_True_simple.<locals>._bar  r  r   r   rP   r  r7   r	  r
  r  r  r  Tr  r6   rd   r,  r  s           r   +test_namesAndDescriptions_w_all_True_simplez?InterfaceClassTests.test_namesAndDescriptions_w_all_True_simple  s    69	 UB'%


 9UB'
 }}WJ}7--
4'-O7//D/9:
5)*e,-
5)*=	
r   c                 :   ddl m} ddl m} d }d } |dd       ||      d} ||       |d	d      d
}| j                  d|      }| j                  d|f|      }| j	                  t        |j                  d            d|d   fd|d   fd|d   fg       y )Nr   r  r  c                       yr  r.   r.   r   r   r  zYInterfaceClassTests.test_namesAndDescriptions_w_all_True_bases_w_same_names.<locals>._bar  r  r   c                       yr  r.   r.   r   r   r"  zYInterfaceClassTests.test_namesAndDescriptions_w_all_True_bases_w_same_names.<locals>._foo  r  r   r   rP   r  r	  r#  r
  r  r  r  Tr  r6   r7   rd   r,  r$  s	            r   7test_namesAndDescriptions_w_all_True_bases_w_same_nameszKInterfaceClassTests.test_namesAndDescriptions_w_all_True_bases_w_same_names  s    69		 UB'%


  %UB'
 }}WJ}7--
4'-O7//D/9:
5)*e,-e,-=	
r   c                 f    | j                         }| j                  t        |j                  d       y r\   )rN   r^   r_   getDescriptionForr%   r  s     r   test_getDescriptionFor_missz/InterfaceClassTests.test_getDescriptionFor_miss  s%    mmo(C$9$9:Fr   c                     ddl m} ddl m} d } |dd       ||      d}| j                  |      }| j	                  |j                  d	      |d	          | j	                  |j                  d
      |d
          y )Nr   r  r  c                       yr  r.   r.   r   r   r  z<InterfaceClassTests.test_getDescriptionFor_hit.<locals>._bar  r  r   r   rP   r  r  rd   r6   )r"   r  r  rN   r#   r:  r  s         r   test_getDescriptionFor_hitz.InterfaceClassTests.test_getDescriptionFor_hit  sx    69	 UB'%
 mm%m(..u5uU|D..u5uU|Dr   c                 \    | j                         fd}| j                  t        |       y )Nc                       d   S r\   r.   )r  s   r   _testz8InterfaceClassTests.test___getitem___miss.<locals>._test  s    z?"r   )rN   r^   r_   )r%   rB  r  s     @r   test___getitem___missz)InterfaceClassTests.test___getitem___miss  s%    mmo	# 	(E*r   c                     ddl m} ddl m} d } |dd       ||      d}| j                  |      }| j	                  |d	   |d	          | j	                  |d
   |d
          y )Nr   r  r  c                       yr  r.   r.   r   r   r  z6InterfaceClassTests.test___getitem___hit.<locals>._bar  r  r   r   rP   r  r  rd   r6   )r"   r  r  rN   r#   r  s         r   test___getitem___hitz(InterfaceClassTests.test___getitem___hit  sj    69	 UB'%
 mm%m(UU5\2UU5\2r   c                 H    | j                         }| j                  d|       y r\   )rN   rz  r;  s     r   test___contains___missz*InterfaceClassTests.test___contains___miss  s    mmoS)r   c                     ddl m} ddl m} d } |dd       ||      d}| j                  |      }| j	                  d	|       | j	                  d
|       y )Nr   r  r  c                       yr  r.   r.   r   r   r  z7InterfaceClassTests.test___contains___hit.<locals>._bar  r  r   r   rP   r  r  rd   r6   )r"   r  r  rN   r7  r  s         r   test___contains___hitz)InterfaceClassTests.test___contains___hit  sV    69	 UB'%
 mm%m(eS!eS!r   c                 f    | j                         }| j                  |j                  d      d        y r\   )rN   r#   directr;  s     r   test_direct_missz$InterfaceClassTests.test_direct_miss  s&    mmoJ/6r   c                    ddl m} ddl m} d }d } |dd       ||      d} ||       |d	d      d
}| j                  d|      }| j                  d|f|      }| j	                  |j                  d      |d          | j	                  |j                  d      |d          | j	                  |j                  d      d        y )Nr   r  r  c                       yr  r.   r.   r   r   r  zBInterfaceClassTests.test_direct_hit_local_miss_bases.<locals>._bar  r  r   c                       yr  r.   r.   r   r   r"  zBInterfaceClassTests.test_direct_hit_local_miss_bases.<locals>._foo  r  r   r   rP   r  r	  r#  r
  r  r  r  rd   r7   r6   )r"   r  r  rN   r#   rM  r$  s	            r    test_direct_hit_local_miss_basesz4InterfaceClassTests.test_direct_hit_local_miss_bases  s    69		 UB'%


  %UB'
 }}WJ}7--
4'-O.e0DE.e0DE.5r   c                 f    | j                         }| j                  |j                  d      d        y r\   )rN   r#   queryDescriptionForrJ  s     r   test_queryDescriptionFor_missz1InterfaceClassTests.test_queryDescriptionFor_miss  s(    22:>Er   c                     ddl m} d |dd      i}| j                  |      }| j                  |j	                  d      |d          y )Nr   r  attrTitleDescriptionr  )r   r  rN   r#   rT  )r%   r  r  r+  s       r   test_queryDescriptionFor_hitz0InterfaceClassTests.test_queryDescriptionFor_hit  sE    ,7M:;E*226:E&MJr   c                     g fd}| j                         }t               }|j                  d|g       | j                  |j	                  |      d        | j                  |fi fg       y )Nc                  ,    j                  | |f       yr   rR  )r   r   _called_withs     r   	_passablezCInterfaceClassTests.test_validateInvariants_pass.<locals>._passable#  s    r
+r   r    )rN   r   rf   r#   validateInvariants)r%   r^  r+  r   r]  s       @r   test_validateInvariants_passz0InterfaceClassTests.test_validateInvariants_pass   sf    	 h\I;711#6=#~6r   c                 "   ddl m g fd}g fd}| j                         }t               }|j	                  d||g       | j                  |j                  |       | j                  |fi fg       | j                  |fi fg       y )Nr   Invalidc                  ,    j                  | |f       yr   rR  r   r   _passable_called_withs     r   r^  zTInterfaceClassTests.test_validateInvariants_fail_wo_errors_passed.<locals>._passable1      !(($4r   c                  .    j                  | |f       r   rR  r   r   rc  _fail_called_withs     r   _failzPInterfaceClassTests.test_validateInvariants_fail_wo_errors_passed.<locals>._fail7      $$dBZ0Mr   r    r  rc  rN   r   rf   r^   r_  r#   )r%   r^  rk  r+  r   rc  rj  rf  s        @@@r   -test_validateInvariants_fail_wo_errors_passedzAInterfaceClassTests.test_validateInvariants_fail_wo_errors_passed-  s    5 "	 	 h\Iu+=>'5#;#;SA.3&"?*sfb\N;r   c                 J   ddl m g }g fd}| j                         }t               }|j	                  d|g       | j                  |j                  ||       | j                  |fi fg       | j                  t        |      d       | j                  |d          y )Nr   rb  c                  .    j                  | |f       r   rR  ri  s     r   rk  zOInterfaceClassTests.test_validateInvariants_fail_w_errors_passed.<locals>._failG  rl  r   r    rn  
r  rc  rN   r   rf   r^   r_  r#   rh  assertIsInstance)r%   _errorsrk  r+  r   rc  rj  s        @@r   ,test_validateInvariants_fail_w_errors_passedz@InterfaceClassTests.test_validateInvariants_fail_w_errors_passedB  s    5	 h\E73'5#;#;S'J*sfb\N;Wq)gaj'2r   c                 n   ddl m g fd}g fd}| j                  d      }| j                  d|f      }t               }|j	                  d|g       |j	                  d|g       | j                  |j                  |       | j                  |fi fg       | j                  |fi fg       y )Nr   rb  c                  ,    j                  | |f       yr   rR  re  s     r   r^  z\InterfaceClassTests.test_validateInvariants_fail_in_base_wo_errors_passed.<locals>._passableW  rg  r   c                  .    j                  | |f       r   rR  ri  s     r   rk  zXInterfaceClassTests.test_validateInvariants_fail_in_base_wo_errors_passed.<locals>._fail]  rl  r   r
  r  r    rm  )	r%   r^  rk  r  r  r   rc  rj  rf  s	         @@@r   5test_validateInvariants_fail_in_base_wo_errors_passedzIInterfaceClassTests.test_validateInvariants_fail_in_base_wo_errors_passedS  s    5 "	 	 }}W%--
TG4hL5'2|i[9'7#=#=sC.3&"?*sfb\N;r   c                   	 ddl m g }g 		fd}g fd}| j                  d      }| j                  d|f      }t               }|j	                  d|g       |j	                  d|g       | j                  |j                  ||       | j                  	|fi fg       | j                  |fi fg       | j                  t        |      d       | j                  |d          y )	Nr   rb  c                  ,    j                  | |f       yr   rR  re  s     r   r^  z[InterfaceClassTests.test_validateInvariants_fail_in_base_w_errors_passed.<locals>._passableo  rg  r   c                  .    j                  | |f       r   rR  ri  s     r   rk  zWInterfaceClassTests.test_validateInvariants_fail_in_base_w_errors_passed.<locals>._failu  rl  r   r
  r  r    rn  rq  )
r%   rs  r^  rk  r  r  r   rc  rj  rf  s
          @@@r   4test_validateInvariants_fail_in_base_w_errors_passedzHInterfaceClassTests.test_validateInvariants_fail_in_base_w_errors_passedj  s    5 "	 	 }}W%--
TG4hL5'2|i[9'7#=#=sGL.3&"?*sfb\N;Wq)gaj'2r   c                     g fd}t               }| j                  d      }|j                  d|g       | j                  d|f      }|j                  |       | j	                  dt                     y )Nc                  ,    j                  | |f       yr   rR  re  s     r   r^  zbInterfaceClassTests.test_validateInvariants_inherited_not_called_multiple_times.<locals>._passable  rg  r   r
  r    r  rn  )r   rN   rf   r_  r#   rh  )r%   r^  r   r  r  rf  s        @r   ;test_validateInvariants_inherited_not_called_multiple_timeszOInterfaceClassTests.test_validateInvariants_inherited_not_called_multiple_times  sm     "	 h}}W%L9+6--
TG4""3'C 567r   c                 f    | j                  d      }| j                  |j                         d       y )NPickleMe)rN   r#   
__reduce__rJ  s     r   test___reduce__z#InterfaceClassTests.test___reduce__  s)    j)))+Z8r   c                 n    | j                  d      }| j                  t        |      t        d             y )NHashMe)r  z#zope.interface.tests.test_interface)rN   r#   hashrJ  s     r   test___hash___normalz(InterfaceClassTests.test___hash___normal  s.    h'KBC	
r   c                      G d d| j                               } |       }| j                  t              5  t        |       d d d        y # 1 sw Y   y xY w)Nc                       e Zd Zd Zy)IInterfaceClassTests.test___hash___missing_required_attrs.<locals>.Derivedc                      y r   r.   r   s    r   r   zRInterfaceClassTests.test___hash___missing_required_attrs.<locals>.Derived.__init__  s    r   Nr   r.   r   r   Derivedr    s    r   r  )rJ   r^   r   r  )r%   r  r  s      r   $test___hash___missing_required_attrsz8InterfaceClassTests.test___hash___missing_required_attrs  sJ    	d**, 	 )~. 	M	 	 	s   AAc                    | j                         }| j                  |d        | j                  |d        | j                  |d        | j                  |d        | j	                  |d k\         | j	                  |d kD         | j	                  d |k         | j	                  d |k         | j                  d |       | j                  d |       | j                  d |       | j                  d |       y r   )rN   
assertLessassertLessEqualassertNotEqualr   assertGreaterEqualassertGreaterrJ  s     r   test_comparison_with_Nonez-InterfaceClassTests.test_comparison_with_None  s    t$UD)E4(E4($'&&'D%(D%(e,4'r   c                    | j                         }| j                  ||k         | j                  ||       | j                  ||       | j                  ||       | j	                  ||       | j                  ||kD         y r   )rN   r   r  r#   r  rJ  s     r   "test_comparison_with_same_instancez6InterfaceClassTests.test_comparison_with_same_instance  sq    'UE*&&u-'r   c                    | j                  dd      }| j                  dd      }| j                  ||       | j                  ||k         | j                  ||       | j                  ||k         | j	                  ||       | j	                  ||       | j	                  ||       | j	                  ||       | j                  ||k\         | j                  ||       | j                  ||kD         | j                  ||       y )NINamezzope.interface.tests.oner   zzope.interface.tests.other)rN   r  r   r  r  r  r  )r%   r  r   s      r   8test_comparison_with_same_named_instance_in_other_modulezLInterfaceClassTests.test_comparison_with_same_named_instance_in_other_module  s    mmG0JmKg2NOU#%S%(#&C'E3'C'E3'&s+u%5#&r   c                 6    G d dt                G fdd| j                               }| j                  d      }| j                  || j                                | j	                  t        |      | j                                | j                  t              5   |d       d d d        ||_        | j                  ||       | j	                  t        |      |       | j                        5   |d       d d d        y # 1 sw Y   `xY w# 1 sw Y   y xY w)Nc                       e Zd Zy)DInterfaceClassTests.test_assignment_to__class__.<locals>.MyExceptionNr   r.   r   r   r   r    r   r   r   c                       e Zd Z fdZy)IInterfaceClassTests.test_assignment_to__class__.<locals>.MyInterfaceClassc                      |      r   r.   )r%   targetr   s     r   __call__zRInterfaceClassTests.test_assignment_to__class__.<locals>.MyInterfaceClass.__call__  s    !&))r   Nr   r   r   r  )r   s   r   MyInterfaceClassr    s    *r   r  r  rn  )	r  rJ   rN   rr  r   typer^   r  	__class__)r%   r  r  r   s      @r   test_assignment_to__class__z/InterfaceClassTests.test_assignment_to__class__  s    	) 		*t335 	* }}W%dD$8$8$:;d4j$"6"6"89y) 	G	 *d$45d4j"23{+ 	G	 		 		 	s   	D1	DDDc                    ddl m}  G d d| j                               } |d|f      }| j                   |d      d        G d d	|      }| j                   |d      d        G d
 d|      }| j	                  t
              5   |        d d d        ||_        | j                   |d      d       y # 1 sw Y   )xY w)Nr   rd  c                       e Zd Zd Zy)JInterfaceClassTests.test_assignment_to__class__2.<locals>.MyInterfaceClassc                     |S r   r.   )r%   r   s     r   r  zSInterfaceClassTests.test_assignment_to__class__2.<locals>.MyInterfaceClass.__call__  s    r   Nr  r.   r   r   r  r    rK  r   r  r  rn  )rn  c                       e Zd Zy)>InterfaceClassTests.test_assignment_to__class__2.<locals>.IBarNr   r.   r   r   r  r    r   r   r  c                       e Zd Zy)?InterfaceClassTests.test_assignment_to__class__2.<locals>.ISpamNr   r.   r   r   ISpamr    r   r   r  )r   re  rJ   r#   r^   r  r  )r%   re  r  r  r  r  s         r   test_assignment_to__class__2z0InterfaceClassTests.test_assignment_to__class__2  s     	-	t335 	  5a$'	4 	 	a$'	I 	 y) 	G	 +q4(		 	s   B55B>c                     | j                         }| j                  t              5  d|_        d d d        y # 1 sw Y   y xY w)Nzdifferent.module)rN   r^   r   r   )r%   r  s     r   test__module__is_readonlyz-InterfaceClassTests.test__module__is_readonly  s7    }}~. 	10DO	1 	1 	1s	   7A )ITestr.   NNN)4r   r   r   rJ   rN   rX   r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r%  r)  r.  r1  r4  r8  r<  r?  rC  rF  rH  rK  rN  rR  rU  rZ  r`  rn  rt  rx  r|  r  r  r  r  r  r  r  r  r  r  r.   r   r   r  r    s    DH O.E5$111L3<3
:9;D$F
(
0A,
,
&
0
8GE+3*"760FK7<*3"<.3489
("	('$.)61r   r  c                   D   e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Z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 Z6y5)6InterfaceTestsc                 v    ddl m ddl m}  G fdd|      }| j                  |d   j                  |       y )Nr   r  rd  c                        e Zd Z W  d      Zy)<InterfaceTests.test_attributes_link_to_interface.<locals>.I1My attrN)r   r   r   rW  r  s   r   I1r    s    Y'Dr   r  rW  )r   r  re  r   r   )r%   re  r  r  s      @r   !test_attributes_link_to_interfacez0InterfaceTests.test_attributes_link_to_interface  s/    ,,	( 	( 	bj**B/r   c                 d    ddl m}  G d d|      }| j                  |d   j                  |       y )Nr   rd  c                       e Zd Zd Zy)9InterfaceTests.test_methods_link_to_interface.<locals>.I1c                      yzA methodNr.   )rd   r6   bingos      r   methodz@InterfaceTests.test_methods_link_to_interface.<locals>.I1.method  r  r   Nr   r   r   r  r.   r   r   r  r    s    r   r  r  )r   re  r   r   )r%   re  r  s      r   test_methods_link_to_interfacez-InterfaceTests.test_methods_link_to_interface  s+    ,	 	 	bl,,b1r   c                    ddl m} ddl m} ddl m}  G d d|       G d d|      } G fd	d
      } |       }| j	                  j                  |             | j                  |j                  |             | j                         | j                   ||             | j                  | ||             | j                   ||             | j                  | ||             y )Nr   rd  r   r   c                       e Zd Zd Zd Zy)<InterfaceTests.test_classImplements_simple.<locals>.ICurrentc                      y	docstringNr.   r   r   s     r   method1zDInterfaceTests.test_classImplements_simple.<locals>.ICurrent.method1'  r  r   c                      yr  r.   r  s     r   method2zDInterfaceTests.test_classImplements_simple.<locals>.ICurrent.method2*  r  r   N)r   r   r   r  r  r.   r   r   ICurrentr  &  s      r   r  c                       e Zd Zy):InterfaceTests.test_classImplements_simple.<locals>.IOtherNr   r.   r   r   r  r  -  r   r   r  c                        e Zd ZW  Zd Zd Zy);InterfaceTests.test_classImplements_simple.<locals>.Currentc                     t               r   r   r%   r   r   s      r   r  zCInterfaceTests.test_classImplements_simple.<locals>.Current.method13      )++r   c                     t               r   r   r  s      r   r  zCInterfaceTests.test_classImplements_simple.<locals>.Current.method26  r  r   N)r   r   r   __implemented__r  r  )r  s   r   Currentr  0  s    &O,,r   r  )	r   re  r   r   r   r   r#   r7  rz  )r%   re  r   r   r  r  currentr  s          @r   test_classImplements_simplez*InterfaceTests.test_classImplements_simple!  s    ,0-	 y 	 	Y 		, 	, )..w78--g678,hg 67w!78h
7 34G!45r   c                    ddl m} ddl m} ddl m}  G d d|       G d d      } G fd	d
      } |       }| j	                  j                  |             | j                  |j                  |             | j                   ||             | j                  | ||             | j                   ||             | j                  | ||             y )Nr   rd  r   r   c                       e Zd Zd Zy)CInterfaceTests.test_classImplements_base_not_derived.<locals>.IBasec                       yr  r.   r.   r   r   r  zJInterfaceTests.test_classImplements_base_not_derived.<locals>.IBase.methodI  r  r   Nr  r.   r   r   r
  r  H       r   r
  c                       e Zd Zy)FInterfaceTests.test_classImplements_base_not_derived.<locals>.IDerivedNr   r.   r   r   r  r  L  r   r   r  c                       e Zd ZW  Zd Zy)EInterfaceTests.test_classImplements_base_not_derived.<locals>.Currentc                     t               r   r   r   s    r   r  zLInterfaceTests.test_classImplements_base_not_derived.<locals>.Current.methodR  r  r   Nr   r   r   r  r  )r
  s   r   r  r  O      #O,r   r  r   re  r   r   r   r   r7  rz  )r%   re  r   r   r  r  r  r
  s          @r   %test_classImplements_base_not_derivedz4InterfaceTests.test_classImplements_base_not_derivedC  s    ,0-	 I 	 	u 		, 	, )++G45//89e]734=#9:eZ01:g#67r   c                 T   ddl m} ddl m} ddl m}  G d d|      } G d d|       G fd	d
      } |       }| j	                  |j                  |             | j	                  j                  |             | j                  | ||             | j                  | ||      j                                | j                   ||             | j                  | ||             | j                  | ||      j                                | j                   ||             y )Nr   rd  r   r   c                       e Zd Zd Zy)CInterfaceTests.test_classImplements_base_and_derived.<locals>.IBasec                       yr  r.   r.   r   r   r  zJInterfaceTests.test_classImplements_base_and_derived.<locals>.IBase.methodd  r  r   Nr  r.   r   r   r
  r  c  r  r   r
  c                       e Zd Zy)FInterfaceTests.test_classImplements_base_and_derived.<locals>.IDerivedNr   r.   r   r   r  r  g  r   r   r  c                       e Zd ZW  Zd Zy)EInterfaceTests.test_classImplements_base_and_derived.<locals>.Currentc                     t               r   r   r   s    r   r  zLInterfaceTests.test_classImplements_base_and_derived.<locals>.Current.methodm  r  r   Nr  )r  s   r   r  r  j  s    &O,r   r  )r   re  r   r   r   rz  r7  	flattened)r%   re  r   r   r
  r  r  r  s          @r   %test_classImplements_base_and_derivedz4InterfaceTests.test_classImplements_base_and_derived^  s    ,0-	 I 	 	u 		, 	, )++G45..w78g 67e]73==?@hg 67
7 34eZ0::<=h
7 34r   c                   	 ddl m} ddl m} ddl m}  G d d|       G d d      	 G fd	d
      } G 	fdd      } G d d||      } |       }| j	                  j                  |             | j	                  	j                  |             | j                   ||             | j                  	 ||             | j                   ||             | j                  	 ||             y )Nr   rd  r   r   c                       e Zd Zd Zy);InterfaceTests.test_classImplements_multiple.<locals>.ILeftc                       yr  r.   r.   r   r   r  zBInterfaceTests.test_classImplements_multiple.<locals>.ILeft.method  r  r   Nr  r.   r   r   ILeftr    r  r   r  c                       e Zd Zy)<InterfaceTests.test_classImplements_multiple.<locals>.IRightNr   r.   r   r   IRightr    r   r   r  c                       e Zd ZW  Zd Zy):InterfaceTests.test_classImplements_multiple.<locals>.Leftc                     t               r   r   r   s    r   r  zAInterfaceTests.test_classImplements_multiple.<locals>.Left.method  r  r   Nr  r  s   r   Leftr    r  r   r  c                       e Zd ZW  Zy);InterfaceTests.test_classImplements_multiple.<locals>.RightNr   r   r   r  r  s   r   Rightr        $Or   r  c                       e Zd Zy):InterfaceTests.test_classImplements_multiple.<locals>.AmbiNr   r.   r   r   Ambir	    r   r   r
  )r   re  r   r   r   r7  )
r%   re  r   r   r  r  r
  ambir  r  s
           @@r   test_classImplements_multiplez,InterfaceTests.test_classImplements_multiple{  s    ,0-	 I 	 	U 		, 	,	% 	%	4 	 v++D12,,T23e]401fmD12eZ-.fj./r   c                   	
 ddl m} ddl m} ddl m}  G d d|       G d d      	 G d	 d
|       G fdd      
 G 	fdd      } G fdd       G 
fdd
|      } |       }| j	                  j                  |             | j                  	j                  |             | j	                  j                  |             | j                   ||             | j                  	 ||             | j                   ||             | j                   ||             | j                  	 ||             | j                   ||             y )Nr   rd  r   r   c                       e Zd Zd Zy)PInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.ILeftc                       yr  r.   r.   r   r   r  zWInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.ILeft.method  r  r   Nr  r.   r   r   r  r    s     r   r  c                       e Zd Zy)QInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.IRightNr   r.   r   r   r  r    r   r   r  c                       e Zd Zy)QInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.IOtherNr   r.   r   r   r  r    r   r   r  c                       e Zd ZW  Zd Zy)OInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.Leftc                     t               r   r   r   s    r   r  zVInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.Left.method  r  r   Nr  r   s   r   r  r    r  r   r  c                       e Zd ZW  Zy)PInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.RightNr  r  s   r   r  r    r  r   r  c                       e Zd ZW  Zy)PInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.OtherNr  )r  s   r   Otherr    r  r   r  c                   B    e Zd ZW  j                  W j                  fZy)PInterfaceTests.test_classImplements_multiple_w_explict_implements.<locals>.MixedNr  )r  r  s   r   Mixedr    s    "22E4I4IIOr   r  r  )r%   re  r   r   r  r  mixedr  r  r  r  r  s          @@@@@r   2test_classImplements_multiple_w_explict_implementszAInterfaceTests.test_classImplements_multiple_w_explict_implements  s$   ,0-	 I 	 
	U 		Y 		, 	,	% 	%	% 	%	JD% 	J ++E23--e45,,U34e]512u!56fmE23eZ./E!23fj/0r   c                 2   ddl m} |j                  } |d      } |d|f      } |d      } |d||f      }| j                  |j	                  |             | j                  |j	                  |             | j                  |j	                  |             | j                  |j	                  |             | j                  |j	                  |             | j                  |j	                  |             | j                  |j	                  |             y )Nr   rd  FunInterfaceBarInterfaceBobInterfaceBazInterface)r   re  r  r   r  r   )r%   re  newr#  r$  r%  r&  s          r   testInterfaceExtendsInterfacez,InterfaceTests.testInterfaceExtendsInterface  s    ,!!>*>L?;>*>L,+HI,,\:;,,\:;,,\:;--l;<--l;<,,\:;--l;<r   c                     ddl m ddl m} ddlm}  G fdd|       G fdd      }| j                   ||             y )	Nr   r  rd  )verifyClassc                   &    e Zd Z W  d      Zd Zy)1InterfaceTests.test_verifyClass.<locals>.ICheckMer  c                       yr  r.   r.   r   r   r  z8InterfaceTests.test_verifyClass.<locals>.ICheckMe.method  r  r   Nr   r   r   rW  r  r  s   r   ICheckMer,        Y'Dr   r/  c                       e Zd ZW  ZdZd Zy)0InterfaceTests.test_verifyClass.<locals>.CheckMevaluec                     t               r   r   r   s    r   r  z7InterfaceTests.test_verifyClass.<locals>.CheckMe.method  r  r   Nr   r   r   r  rW  r  r/  s   r   CheckMer2        &OD,r   r7  )r   r  re  r   r*  r   )r%   re  r*  r7  r  r/  s       @@r   test_verifyClasszInterfaceTests.test_verifyClass  s7    ,,5	y 		, 	, 	Hg67r   c                     ddl m ddl m} ddlm}  G fdd|       G fdd      } |       }| j                   ||             y )	Nr   r  rd  r|   c                   &    e Zd Z W  d      Zd Zy)2InterfaceTests.test_verifyObject.<locals>.ICheckMer  c                       yr  r.   r.   r   r   r  z9InterfaceTests.test_verifyObject.<locals>.ICheckMe.method  r  r   Nr.  r  s   r   r/  r<    r0  r   r/  c                       e Zd ZW  ZdZd Zy)1InterfaceTests.test_verifyObject.<locals>.CheckMer3  c                     t               r   r   r   s    r   r  z8InterfaceTests.test_verifyObject.<locals>.CheckMe.method  r  r   Nr5  r6  s   r   r7  r?    r8  r   r7  )r   r  re  r   r}   r   )r%   re  r}   r7  check_mer  r/  s        @@r   test_verifyObjectz InterfaceTests.test_verifyObject  s>    ,,6	y 		, 	, 9Xx89r   c                 f    ddl m}  G d d|      }| j                  |j                  |             y )Nr   rd  c                       e Zd Zy)LInterfaceTests.test_interface_object_provides_Interface.<locals>.AnInterfaceNr   r.   r   r   AnInterfacerE    r   r   rF  )r   re  r   r   )r%   re  rF  s      r   (test_interface_object_provides_Interfacez7InterfaceTests.test_interface_object_provides_Interface  s*    ,	) 	 		,,[9:r   c                     ddl m ddl m}  G fdd|      }| j                  t	        |j                               ddg       y )Nr   r  rd  c                   &    e Zd Z W  d      Zd Zy)1InterfaceTests.test_names_simple.<locals>.ISimpler  c                       yr  r.   r.   r   r   r  z8InterfaceTests.test_names_simple.<locals>.ISimple.method  r  r   Nr.  r  s   r   ISimplerJ        Y'D r   rL  rW  r  r   r  re  r#   r  r  r%   re  rL  r  s      @r   test_names_simplez InterfaceTests.test_names_simple
  s7    ,,	 i 	  	0682DEr   c                    ddl m ddl m}  G fdd|      } G fdd|      }| j                  t	        |j                               g d       | j                  t	        |j                  d	
            g d       y )Nr   r  rd  c                   &    e Zd Z W  d      Zd Zy)0InterfaceTests.test_names_derived.<locals>.IBaser  c                       yr  r.   r.   r   r   r  z7InterfaceTests.test_names_derived.<locals>.IBase.method  r  r   Nr.  r  s   r   r
  rS    rM  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)3InterfaceTests.test_names_derived.<locals>.IDerivedMy attr2c                       yr  r.   r.   r   r   r  z:InterfaceTests.test_names_derived.<locals>.IDerived.method#  r  r   c                       yr  r.   r.   r   r   r  z;InterfaceTests.test_names_derived.<locals>.IDerived.method2&  r  r   Nr   r   r   attr2r  r  r  s   r   r  rV     s    j)E  r   r  )r[  r  r  Tr  rW  r[  r  r  rN  r%   re  r
  r  r  s       @r   test_names_derivedz!InterfaceTests.test_names_derived  sf    ,,	 I 	 	 u 	  	 017	94 89?	Ar   c                 |   ddl m ddl m} ddlm}  G fdd|      }t        |j                               }| j                  t        |      d       | j                  |d   d   d       | j                  |d   d	          | j                  |d   d	   j                  d       | j                  |d   d	   j                  d
       | j                  |d	   d   d       | j                  |d	   d	   |       | j                  |d	   d	   j                  d       | j                  |d	   d	   j                  d       y )Nr   r  rd  Methodc                   &    e Zd Z W  d      Zd Zy)@InterfaceTests.test_namesAndDescriptions_simple.<locals>.ISimpler  c                       y	My methodNr.   r.   r   r   r  zGInterfaceTests.test_namesAndDescriptions_simple.<locals>.ISimple.method6  r  r   Nr.  r  s   r   rL  rc  3      Y'Dr   rL  rf  rW  rn  r  r  rf  r   r  re  r"   ra  r  r-  r#   rh  rr  r   rR   )r%   re  ra  rL  name_valuesr  s        @r    test_namesAndDescriptions_simplez/InterfaceTests.test_namesAndDescriptions_simple.  s"   ,,3	i 	 W99;<[)1-Q*F3k!nQ/;Q*33V<Q*22I>Q*H5k!nQ/8Q*33X>Q*22K@r   c                    ddl m ddl m} ddlm}  G fdd|      } G fdd|      }t        |j                               }| j                  t        |      d	       | j                  |d   d   d
       | j                  |d   d          | j                  |d   d   j                  d
       | j                  |d   d   j                  d       | j                  |d   d   d       | j                  |d   d   |       | j                  |d   d   j                  d       | j                  |d   d   j                  d       | j                  |d   d   d       | j                  |d   d   |       | j                  |d   d   j                  d       | j                  |d   d   j                  d       t        |j                  d            }| j                  t        |      d       | j                  |d   d   d       | j                  |d   d          | j                  |d   d   j                  d       | j                  |d   d   j                  d       | j                  |d   d   d
       | j                  |d   d          | j                  |d   d   j                  d
       | j                  |d   d   j                  d       | j                  |d   d   d       | j                  |d   d   |       | j                  |d   d   j                  d       | j                  |d   d   j                  d       | j                  |d	   d   d       | j                  |d	   d   |       | j                  |d	   d   j                  d       | j                  |d	   d   j                  d       y )Nr   r  rd  r`  c                   &    e Zd Z W  d      Zd Zy)?InterfaceTests.test_namesAndDescriptions_derived.<locals>.IBaser  c                       yre  r.   r.   r   r   r  zFInterfaceTests.test_namesAndDescriptions_derived.<locals>.IBase.methodM  r  r   Nr.  r  s   r   r
  rm  J  rg  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)BInterfaceTests.test_namesAndDescriptions_derived.<locals>.IDerivedrW  c                       yMy method, overriddenNr.   r.   r   r   r  zIInterfaceTests.test_namesAndDescriptions_derived.<locals>.IDerived.methodS  r  r   c                       y
My method2Nr.   r.   r   r   r  zJInterfaceTests.test_namesAndDescriptions_derived.<locals>.IDerived.method2V  r  r   NrZ  r  s   r   r  rp  P      j)E(r   r     r[  rn  rW  r  rs  rf  r  rv  Tr     rW  r  rh  )r%   re  ra  r
  r  ri  r  s         @r   !test_namesAndDescriptions_derivedz0InterfaceTests.test_namesAndDescriptions_derivedE  s   ,,3	I 		u 	 X::<=[)1-Q*G4k!nQ/;Q*33W=Q*22J?Q*H5k!nQ/8Q*33X>Q*224KLQ*I6k!nQ/8Q*33Y?Q*22LAX::t:DE[)1-Q*F3k!nQ/;Q*33V<Q*22I>Q*G4k!nQ/;Q*33W=Q*22J?Q*H5k!nQ/8Q*33X>Q*224KLQ*I6k!nQ/8Q*33Y?Q*22LAr   c                 h    ddl m}  G d d|      }| j                  t        |j                  d       y )Nr   rd  c                       e Zd Zy)IInterfaceTests.test_getDescriptionFor_nonesuch_no_default.<locals>.IEmptyNr   r.   r   r   IEmptyr}    r   r   r~  r]   )r   re  r^   r_   r:  r%   re  r~  s      r   *test_getDescriptionFor_nonesuch_no_defaultz9InterfaceTests.test_getDescriptionFor_nonesuch_no_default}  s+    ,	Y 	 	(F$<$<jIr   c                    ddl m ddl m} ddlm}  G fdd|      }|j                  d      }| j                  |       | j                  |j                  d       | j                  |j                  d       |j                  d	      }| j                  ||       | j                  |j                  d	       | j                  |j                  d
       y )Nr   r  rd  r`  c                   &    e Zd Z W  d      Zd Zy)=InterfaceTests.test_getDescriptionFor_simple.<locals>.ISimpler  c                       yre  r.   r.   r   r   r  zDInterfaceTests.test_getDescriptionFor_simple.<locals>.ISimple.method  r  r   Nr.  r  s   r   rL  r    rg  r   rL  rW  r  r  rf  
r   r  re  r"   ra  r:  rr  r#   r   rR   r%   re  ra  rL  a_descm_descr  s         @r   test_getDescriptionFor_simplez,InterfaceTests.test_getDescriptionFor_simple  s    ,,3	i 	 **62fi0&13**84ff-(35r   c                 6  	 ddl m	 ddl m} ddlm}  G 	fdd|      } G 	fdd|      }|j                  d	      }| j                  |	       | j                  |j                  d	       | j                  |j                  d
       |j                  d      }| j                  ||       | j                  |j                  d       | j                  |j                  d       |j                  d      }| j                  |	       | j                  |j                  d       | j                  |j                  d       |j                  d      }| j                  ||       | j                  |j                  d       | j                  |j                  d       y )Nr   r  rd  r`  c                   &    e Zd Z W  d      Zd Zy)<InterfaceTests.test_getDescriptionFor_derived.<locals>.IBaser  c                       yre  r.   r.   r   r   r  zCInterfaceTests.test_getDescriptionFor_derived.<locals>.IBase.method  r  r   Nr.  r  s   r   r
  r    rg  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)?InterfaceTests.test_getDescriptionFor_derived.<locals>.IDerivedrW  c                       yrr  r.   r.   r   r   r  zFInterfaceTests.test_getDescriptionFor_derived.<locals>.IDerived.method  r  r   c                       yru  r.   r.   r   r   r  zGInterfaceTests.test_getDescriptionFor_derived.<locals>.IDerived.method2  r  r   NrZ  r  s   r   r  r    rw  r   r  rW  r  r  rs  r[  rW  r  rv  r  
r%   re  ra  r
  r  r  r  a2_descm2_descr  s
            @r   test_getDescriptionFor_derivedz-InterfaceTests.test_getDescriptionFor_derived  sK   ,,3	I 		u 	 ++F3fi0&13++H5ff-(3)@A,,W5gy1))73*5,,Y7gv.))95,7r   c                 h    ddl m}  G d d|      }| j                  t        |j                  d       y )Nr   rd  c                       e Zd Zy)7InterfaceTests.test___getitem__nonesuch.<locals>.IEmptyNr   r.   r   r   r~  r    r   r   r~  r]   )r   re  r^   r_   __getitem__r  s      r   test___getitem__nonesuchz'InterfaceTests.test___getitem__nonesuch  s+    ,	Y 	 	(F$6$6
Cr   c                    ddl m ddl m} ddlm}  G fdd|      }|d   }| j                  |       | j                  |j                  d       | j                  |j                  d       |d	   }| j                  ||       | j                  |j                  d	       | j                  |j                  d
       y )Nr   r  rd  r`  c                   &    e Zd Z W  d      Zd Zy)6InterfaceTests.test___getitem__simple.<locals>.ISimpler  c                       yre  r.   r.   r   r   r  z=InterfaceTests.test___getitem__simple.<locals>.ISimple.method  r  r   Nr.  r  s   r   rL  r    rg  r   rL  rW  r  r  rf  	r   r  re  r"   ra  rr  r#   r   rR   r  s         @r   test___getitem__simplez%InterfaceTests.test___getitem__simple  s    ,,3	i 	 fi0&13"ff-(35r   c                   	 ddl m	 ddl m} ddlm}  G 	fdd|      } G 	fdd|      }|d	   }| j                  |	       | j                  |j                  d	       | j                  |j                  d
       |d   }| j                  ||       | j                  |j                  d       | j                  |j                  d       |d   }| j                  |	       | j                  |j                  d       | j                  |j                  d       |d   }| j                  ||       | j                  |j                  d       | j                  |j                  d       y )Nr   r  rd  r`  c                   &    e Zd Z W  d      Zd Zy)6InterfaceTests.test___getitem___derived.<locals>.IBaser  c                       yre  r.   r.   r   r   r  z=InterfaceTests.test___getitem___derived.<locals>.IBase.method  r  r   Nr.  r  s   r   r
  r    rg  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)9InterfaceTests.test___getitem___derived.<locals>.IDerivedrW  c                       yrr  r.   r.   r   r   r  z@InterfaceTests.test___getitem___derived.<locals>.IDerived.method  r  r   c                       yru  r.   r.   r   r   r  zAInterfaceTests.test___getitem___derived.<locals>.IDerived.method2  r  r   NrZ  r  s   r   r  r    rw  r   r  rW  r  r  rs  r[  rW  r  rv  r  r  s
            @r   test___getitem___derivedz'InterfaceTests.test___getitem___derived  s3   ,,3	I 		u 	 &!fi0&13(#ff-(3)@A7#gy1))73*59%gv.))95,7r   c                 J    ddl m}  G d d|      }| j                  d|       y )Nr   rd  c                       e Zd Zy)8InterfaceTests.test___contains__nonesuch.<locals>.IEmptyNr   r.   r   r   r~  r  
  r   r   r~  r]   )r   re  rz  r  s      r   test___contains__nonesuchz(InterfaceTests.test___contains__nonesuch  s#    ,	Y 	 	V,r   c                     ddl m ddl m}  G fdd|      }| j                  d|       | j                  d|       y )Nr   r  rd  c                   &    e Zd Z W  d      Zd Zy)7InterfaceTests.test___contains__simple.<locals>.ISimpler  c                       yre  r.   r.   r   r   r  z>InterfaceTests.test___contains__simple.<locals>.ISimple.method  r  r   Nr.  r  s   r   rL  r    rg  r   rL  rW  r  r   r  re  r7  rO  s      @r   test___contains__simplez&InterfaceTests.test___contains__simple  s3    ,,	i 	 	fg&h(r   c                     ddl m ddl m}  G fdd|      } G fdd|      }| j                  d|       | j                  d	|       | j                  d
|       | j                  d|       y )Nr   r  rd  c                   &    e Zd Z W  d      Zd Zy)6InterfaceTests.test___contains__derived.<locals>.IBaser  c                       yre  r.   r.   r   r   r  z=InterfaceTests.test___contains__derived.<locals>.IBase.method#  r  r   Nr.  r  s   r   r
  r     rg  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)9InterfaceTests.test___contains__derived.<locals>.IDerivedrW  c                       yrr  r.   r.   r   r   r  z@InterfaceTests.test___contains__derived.<locals>.IDerived.method)  r  r   c                       yru  r.   r.   r   r   r  zAInterfaceTests.test___contains__derived.<locals>.IDerived.method2,  r  r   NrZ  r  s   r   r  r  &  rw  r   r  rW  r  r[  r  r  r]  s       @r   test___contains__derivedz'InterfaceTests.test___contains__derived  s[    ,,	I 		u 	 	fh'h)gx(i*r   c                 \    ddl m}  G d d|      }| j                  t        |      g        y )Nr   rd  c                       e Zd Zy)1InterfaceTests.test___iter__empty.<locals>.IEmptyNr   r.   r   r   r~  r  7  r   r   r~  )r   re  r#   rT   r  s      r   test___iter__emptyz!InterfaceTests.test___iter__empty4  s'    ,	Y 	 	fr*r   c                     ddl m ddl m}  G fdd|      }| j                  t	        t        |            ddg       y )Nr   r  rd  c                   &    e Zd Z W  d      Zd Zy)3InterfaceTests.test___iter__simple.<locals>.ISimpler  c                       yre  r.   r.   r   r   r  z:InterfaceTests.test___iter__simple.<locals>.ISimple.methodC  r  r   Nr.  r  s   r   rL  r  @  rg  r   rL  rW  r  r   r  re  r#   r  rT   rO  s      @r   test___iter__simplez"InterfaceTests.test___iter__simple<  s5    ,,	i 	 	W.0BCr   c                     ddl m ddl m}  G fdd|      } G fdd|      }| j                  t	        t        |            g d       y )	Nr   r  rd  c                   &    e Zd Z W  d      Zd Zy)2InterfaceTests.test___iter__derived.<locals>.IBaser  c                       yre  r.   r.   r   r   r  z9InterfaceTests.test___iter__derived.<locals>.IBase.methodO  r  r   Nr.  r  s   r   r
  r  L  rg  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)5InterfaceTests.test___iter__derived.<locals>.IDerivedrW  c                       yrr  r.   r.   r   r   r  z<InterfaceTests.test___iter__derived.<locals>.IDerived.methodU  r  r   c                       yru  r.   r.   r   r   r  z=InterfaceTests.test___iter__derived.<locals>.IDerived.method2X  r  r   NrZ  r  s   r   r  r  R  rw  r   r  r\  r  r]  s       @r   test___iter__derivedz#InterfaceTests.test___iter__derivedH  s@    ,,	I 		u 	 	X/?	Ar   c                 r    ddl m}  G d d|      }|d   }| j                  |j                  d      d       y )Nr   rd  c                        e Zd Zd Zde_        y)LInterfaceTests.test_function_attributes_become_tagged_values.<locals>.ITagMec                       yr  r.   r.   r   r   r  zSInterfaceTests.test_function_attributes_become_tagged_values.<locals>.ITagMe.methodb  r  r   rn  N)r   r   r   r  optionalr.   r   r   ITagMer  a  s     FOr   r  r  r  rn  )r   re  r#   r`   )r%   re  r  r  s       r   -test_function_attributes_become_tagged_valuesz<InterfaceTests.test_function_attributes_become_tagged_values^  s8    ,	 Y 	 
 !..z:A>r   c                     ddl m}  G d d|      }| j                  |j                  d       | j                  t	        |      g        y )Nr   rd  c                       e Zd ZdZy)@InterfaceTests.test___doc___non_element.<locals>.IHaveADocStringxxxNr   r   r   rR   r.   r   r   IHaveADocStringr  l      r   r  r  )r   re  r#   rR   rT   )r%   re  r  s      r   test___doc___non_elementz'InterfaceTests.test___doc___non_elementi  s>    ,	i 	 	00%8o.3r   c                     ddl m ddl m}  G fdd|      }| j                  |j                  d       | j                  t        |      dg       y )Nr   r  rd  c                   $    e Zd ZdZ W  d      Zy)?InterfaceTests.test___doc___as_element.<locals>.IHaveADocStringr  the docNr  r  s   r   r  r  v  s    	*Gr   r  rP   rR   r   r  re  r#   rR   rT   )r%   re  r  r  s      @r   test___doc___as_elementz&InterfaceTests.test___doc___as_elementr  sD    ,,	+i 	+ 	00"5o.<r   c                    ddl m} | j                  ||j                  |       g }	 |j                  ||       | j	                  d       | j                  t        |      |       |D cg c]  }|j                  d    }}|j                          |D ]#  }	| j                  |	|j                  d             % y # |$ r)}| j                  |j                  d   |       Y d }~d }~ww xY wc c}w )Nr   rb  z&validateInvariants should always raise)
r  rc  r^   r_  failr#   r   rh  sortpop)
r%   has_invariant	error_len
error_msgsr+  rc  eerrormsgsmsgs
             r   _errorsEqualzInterfaceTests._errorsEqual}  s    5'5#;#;]K	/$$]A6II>? 	Q++,-%

1--		 	5CS*.."34	5  	/UZZ]A..	/ .s   #B: )C+:C(?C##C(c                    ddl m ddl m} ddl m} ddl m  G fdd|      } G d d	      } |       } |||       | j                  |j                  d
      t        g       | j                  |j                  |      d        d|_	        | j                  |j                  |      d        d|_
        | j                  |j                  |      d        |`	| j                  |ddg|       y )Nr   r  rd  directlyProvidesr   c                   D    e Zd Z W  d      Z W  d      Z W e       y)8InterfaceTests.test_invariant_simple.<locals>.IInvariantrd   *bar; must eval to Boolean True if foo doesNr   r   r   rd   r6   _ifFooThenBarr  r   s   r   
IInvariantr         E"CHICm$r   r  c                       e Zd Zy):InterfaceTests.test_invariant_simple.<locals>.HasInvariantNr   r.   r   r   HasInvariantr    r   r   r  r       *   rn  If Foo, then Bar!)r   r  re  r  r   r#   r`   r  r_  r6   rd   r  )r%   re  r  r  r  r  r  r   s         @@r   test_invariant_simplez$InterfaceTests.test_invariant_simple  s    ,,3,	% 	%
	 	 %
3 	22<@'	*66}EtL66}EtL66}EtL--@,A$	&r   c                    ddl m ddl m} ddl m} ddl m  G fdd|      } G fdd	|      } G d
 d      }| j                  |j                  d      t        g        |       } |||       d|_        | j                  |ddg|       d|_        d|_
        | j                  |ddg|       d|_        d|_
        | j                  |dddg|       d|_        d|_
        | j                  |j                  |      d        y )Nr   r  rd  r  r   c                   D    e Zd Z W  d      Z W  d      Z W e       y)8InterfaceTests.test_invariant_nested.<locals>.IInvariantrd   r  Nr  r  s   r   r  r    r  r   r  c                        e Zd Z W  e       y);InterfaceTests.test_invariant_nested.<locals>.ISubInvariantN)r   r   r   _barGreaterThanFoor   s   r   ISubInvariantr    s    ()r   r	  c                       e Zd Zy):InterfaceTests.test_invariant_nested.<locals>.HasInvariantNr   r.   r   r   r  r    r   r   r  r    r   rn  r  rf  %Please, Boo MUST be greater than Foo!)r   r  re  r  r   r#   r`   r  rd   r  r6   r_  )	r%   re  r  r  r	  r  r  r  r   s	          @@r   test_invariant_nestedz$InterfaceTests.test_invariant_nested  s   ,,3,	% 	%
	*J 	*	 	 	55lC,-	/$6 	--@,A'	) -BC'	)
 -.BD'	)
 66}EtLr   c                 J  	 ddl m ddl m} ddl m} ddl m	  G 	fdd|      } G d d	      } |       } |||       d
|_        |j                  d      }|d d  }|j                  t               |j                  d|       | j                  |ddg|       d|_        d|_        | j                  |ddg|       d|_        d|_        | j                  |dddg|       d|_        d|_        | j                  |j                  |      d        |j                  d|       y )Nr   r  rd  r  r   c                   D    e Zd Z W  d      Z W  d      Z W e       y):InterfaceTests.test_invariant_mutandis.<locals>.IInvariantrd   r  Nr  r  s   r   r  r    r  r   r  c                       e Zd Zy)<InterfaceTests.test_invariant_mutandis.<locals>.HasInvariantNr   r.   r   r   r  r    r   r   r  r   r    rn  r  rf  r  )r   r  re  r  r   rd   r`   rS  r  rf   r  r6   r#   r_  )
r%   re  r  r  r  r  old_invariantsr    r  r   s
           @@r   test_invariant_mutandisz&InterfaceTests.test_invariant_mutandis  s7   ,,3,	% 	%
	 	 %
3 $22<@#A&
,-!!,
; 	--@,A$	& 45		
 -.BD$	&
 66}EtL!!,?r   c                 ,   ddl m ddl m}  G d d|      }| j                  |j                  d       | j                  t        |      g         G fdd|      }| j                  |j                  d	       | j                  t        |      d
g       y )Nr   r  rd  c                       e Zd ZdZy)7InterfaceTests.test___doc___element.<locals>.IDocstringr  Nr  r.   r   r   
IDocstringr    r  r   r  r  c                   $    e Zd ZdZ W  d      Zy)CInterfaceTests.test___doc___element.<locals>.IDocstringAndAttributer  r  Nr  r  s   r   IDocstringAndAttributer    s    	*Gr   r  rP   rR   r  )r%   re  r  r  r  s       @r   test___doc___elementz#InterfaceTests.test___doc___element  s    ,,	 	 	++U3j)2.	+Y 	+
 	/77<45	{Cr   c                 z   ddl m ddl m} ddl m} ddl m ddlm  G fdd|      } ||       G d	 d
             }|j                   |dd             |j                   |dd             	 |j                   |dd             y # $ r%}| j                  t        |      d       Y d }~y d }~ww xY w)Nr   r  rd  r  r   rb  c                   H    e Zd Z W  d      Z W  d      ZW fd       Zy):InterfaceTests.test_invariant_as_decorator.<locals>.IRangezLower boundzUpper boundc                 H    | j                   | j                  k  r d      y )N	max < min)maxmin)obrc  s    r   range_invariantzJInterfaceTests.test_invariant_as_decorator.<locals>.IRange.range_invariant0  s"    66BFF?!+.. #r   N)r   r   r   r#  r"  r%  )r  rc  r   s   r   IRanger  ,  s)    M*CM*C/ /r   r&  c                       e Zd Zd Zy)9InterfaceTests.test_invariant_as_decorator.<locals>.Rangec                 "    ||c| _         | _        y r   )r#  r"  )r%   r#  r"  s      r   r   zBInterfaceTests.test_invariant_as_decorator.<locals>.Range.__init__8  s    %(#"$(r   Nr   r.   r   r   Ranger(  5  s    .r   r*  rn  rf  r!  )
r   r  re  r  r   r  rc  r_  r#   r8  )	r%   re  r  r&  r*  r  r  rc  r   s	         @@@r   test_invariant_as_decoratorz*InterfaceTests.test_invariant_as_decorator%  s    ,,.,5	/ 	/Y 	/ 
V		. 	. 
	.
 	!!%1+.!!%1+.	2%%eAqk2 	2SV[11	2s   7B B:B55B:c                 *   ddl m ddl m} ddl m  G fdd|      } G fdd|      } G d	 d
|      }| j	                  |j                  d      d       | j                  t        |j
                  d       | j	                  t        |j                               dg       | j	                  |j                  d      d       | j	                  |j                  d      d       | j	                  t        |j                               ddh       y )Nr   r  rd  r2   c                   F    e Zd Z W  d      Z W  d      Z W dd       y)0InterfaceTests.test_taggedValue.<locals>.ITaggedrd   r  r=   SpamN)r   r   r   rd   r6   r  r3   s   r   ITaggedr.  G  s"    E"CHICv&r   r1  c                   6    e Zd Z W  dd        W  dd       y)1InterfaceTests.test_taggedValue.<locals>.IDerivedr=   	Spam Spamrd   r6   Nr   r2   s   r   r  r3  L  s    {+u%r   r  c                       e Zd Zy)2InterfaceTests.test_taggedValue.<locals>.IDerived2Nr   r.   r   r   	IDerived2r6  P  r   r   r7  r=   r/  rd   r4  r6   )r   r  re  r3   r#   r`   r^   r_   rT   rU   set)r%   re  r1  r  r7  r  r3   s        @@r   test_taggedValuezInterfaceTests.test_taggedValueB  s    ,,.	'i 	'
	&w 	&	 	 	//6?(G$:$:EBg88:;eWE11%8+F11%8%@Y99;<uenMr   c                    	 ddl m ddl m	  G 	fdd|      } G 	fdd|      } G 	fdd	|      } G 	fd
d||      } G d d||      } G d d||      }|S )Nr   r  r2   c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.FtagFNr   r   r   r=  r0  s   r   r>  r<  _      s#C.Cr   r>  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.Er=  ENr?  r0  s   r   rC  rB  c  r@  r   rC  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.Dr=  DNr?  r0  s   r   rF  rE  g  r@  r   rF  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.Cr=  CNr?  r0  s   r   rI  rH  k  r@  r   rI  c                       e Zd Zy)0InterfaceTests._make_taggedValue_tree.<locals>.BNr   r.   r   r   BrK  o  r   r   rL  c                       e Zd Zy)0InterfaceTests._make_taggedValue_tree.<locals>.ANr   r.   r   r   ArN  r  r   r   rO  )r   r  r3   )
r%   r  r>  rC  rF  rI  rL  rO  r  r3   s
           @@r   _make_taggedValue_treez%InterfaceTests._make_taggedValue_tree[  s^    ,.	! 	!	! 	!	! 	!	!1 	!	1 		1 	 r   c                 &   ddl m} | j                  t              }| j	                  |j
                  j                  d       | j                  |      }| j	                  |d   j                  d       | j	                  |j                  d      d       | j	                  |j                  d      d       |j                  d   j                  dk(  sJ |j                  d   j                  dd       | j	                  |j                  d      d       y )Nr   rd  rI  r=  rL  )r   re  rP  r   r#   r=  r   r`   rj   rg  rf   )r%   re  class_Aiface_As       r   "test_getTaggedValue_follows__iro__z1InterfaceTests.test_getTaggedValue_follows__iro__w  s     	- --f5--s3 --i800#6//6<11%8#>  #,,333!++E37//6<r   c                 j   ddl m} | j                  |      }| j                  |j	                  d             | j                  g t        |j                                      | j                  t              5  |j                  d       d d d        |j                  dd       | j                  |j	                  d      d       | j                  |j                  d      d       | j                  dgt        |j                                      |j                  d   j                  dk(  sJ |j                  d   }| j                  |j	                  d      d       | j                  |j                  d      d       | j                  dgt        |j                                      y # 1 sw Y   "xY w)Nr   rd  r=  rO  rn  rI  )r   re  rP  r  rt   r#   rT   re   r^   r_   rp   rf   rg  r   )r%   re  rO  rI  s       r   (test_getDirectTaggedValue_ignores__iro__z7InterfaceTests.test_getDirectTaggedValue_ignores__iro__  sd   ,''	2!2259:T!"<"<">?@x( 	*""5)	* 	
$11%8#>//6<%$q'A'A'C"DE{{1~&&#---KKN11%8#>//6<%$q'A'A'C"DE	* 	*s   6F((F2c                    ddl m ddl m}  G fdd|      } G d d|      } G d d	|      }| j                  |j	                  d
      |j	                  d
             |f|_        | j                  |j	                  d
             y )Nr   r  rd  c                        e Zd Z W  d      Zy)<InterfaceTests.test_description_cache_management.<locals>.I1r   N)r   r   r   r   r  s   r   r  rY    s    #Ar   r  c                       e Zd Zy)<InterfaceTests.test_description_cache_management.<locals>.I2Nr   r.   r   r   I2r[    r   r   r\  c                       e Zd Zy)<InterfaceTests.test_description_cache_management.<locals>.I3Nr   r.   r   r   I3r^    r   r   r_  r   )r   r  re  r   r  rg  r  )r%   re  r  r\  r_  r  s        @r   !test_description_cache_managementz0InterfaceTests.test_description_cache_management  sn     	-,	 		 		 	 	bffSk266#;/!|"&&+&r   c                     ddl m} ddl m}  G d d|      } ||       G d d             }| j                   | |             d       y )Nr   rd  r  c                       e Zd Zy)AInterfaceTests.test___call___defers_to___conform___.<locals>.IFooNr   r.   r   r   r  rc    r   r   r  c                       e Zd Zd Zy)>InterfaceTests.test___call___defers_to___conform___.<locals>.Cc                      y)Nr   r.   )r%   protos     r   r-  zJInterfaceTests.test___call___defers_to___conform___.<locals>.C.__conform__  s    r   Nr.  r.   r   r   rI  re    s    r   rI  )r   re  r  r#   )r%   re  r  r  rI  s        r   $test___call___defers_to___conform___z3InterfaceTests.test___call___defers_to___conform___  sJ    ,.	9 	 
T		 	 
	 	acA&r   c                     ddl m} ddl m}  G d d|      } ||       G d d             } |       }| j                   ||      |       y )Nr   rd  r  c                       e Zd Zy)<InterfaceTests.test___call___object_implements.<locals>.IFooNr   r.   r   r   r  rk    r   r   r  c                       e Zd Zy)9InterfaceTests.test___call___object_implements.<locals>.CNr   r.   r   r   rI  rm    r  r   rI  )r   re  r  r   )r%   re  r  r  rI  cs         r   test___call___object_implementsz.InterfaceTests.test___call___object_implements  sM    ,.	9 	 
T		 	 
	 Cd1gq!r   c                 v    ddl m}  G d d|      } G d d      } |       }| j                  t        ||       y )Nr   rd  c                       e Zd Zy)<InterfaceTests.test___call___miss_wo_alternate.<locals>.IFooNr   r.   r   r   r  rr    r   r   r  c                       e Zd Zy)9InterfaceTests.test___call___miss_wo_alternate.<locals>.CNr   r.   r   r   rI  rt    r   r   rI  )r   re  r^   r  r%   re  r  rI  rn  s        r   test___call___miss_wo_alternatez.InterfaceTests.test___call___miss_wo_alternate  s6    ,	9 		 	 C)T1-r   c                 z    ddl m}  G d d|      } G d d      } |       }| j                   |||       |        y )Nr   rd  c                       e Zd Zy);InterfaceTests.test___call___miss_w_alternate.<locals>.IFooNr   r.   r   r   r  ry    r   r   r  c                       e Zd Zy)8InterfaceTests.test___call___miss_w_alternate.<locals>.CNr   r.   r   r   rI  r{    r   r   rI  )r   re  r   ru  s        r   test___call___miss_w_alternatez-InterfaceTests.test___call___miss_w_alternate  s8    ,	9 		 	 Cd1dmT*r   c                      ddl m} ddlm} d } fd} G d d|      } G d d	      } |       }|d d  }||g|d d  	  j	                   ||              ||d d  y # ||d d  w xY w)
Nr   rd  rY  c                      y r   r.   rW  s     r   _missz:InterfaceTests.test___call___w_adapter_hook.<locals>._miss  s    r   c                     S r   r.   )r+  r   r%   s     r   _hitz9InterfaceTests.test___call___w_adapter_hook.<locals>._hit  s    Kr   c                       e Zd Zy)9InterfaceTests.test___call___w_adapter_hook.<locals>.IFooNr   r.   r   r   r  r    r   r   r  c                       e Zd Zy)6InterfaceTests.test___call___w_adapter_hook.<locals>.CNr   r.   r   r   rI  r    r   r   rI  )r   re  r"   rZ  r   )	r%   re  rZ  r  r  r  rI  rn  old_adapter_hookss	   `        r   test___call___w_adapter_hookz+InterfaceTests.test___call___w_adapter_hook  sx    ,:			9 		 	 C)!,!4=a	1MM$q'4(0M!0M!s   A A$c                     ddl m} ddl m} ddl m  G fdd|      } ||       G d d             }| j	                  d	 |t                            | j	                  d	 | |                    y )
Nr   rd  r  interfacemethodc                        e Zd ZW  d        Zy)=InterfaceTests.test___call___w_overridden_adapt.<locals>.IFooc                      yNr   r.   r%   r   s     r   rN  zGInterfaceTests.test___call___w_overridden_adapt.<locals>.IFoo.__adapt__	      r   Nr   r   r   rN  r  s   r   r  r  		  s     r   r  c                       e Zd Zy)<InterfaceTests.test___call___w_overridden_adapt.<locals>.ObjNr   r.   r   r   Objr  	  r  r   r  r   )r   re  r  r  r#   r   )r%   re  r  r  r  r  s        @r    test___call___w_overridden_adaptz/InterfaceTests.test___call___w_overridden_adapt	  sf    ,.2	9 	 
T		 	 
	 	T&(^, 	T#%[)r   c                 
   ddl m} ddl m} ddl m  G fdd|      } G d d|      } ||       G d	 d
             } ||       G d d             }| j	                  d |t                            | j	                  d | |                    | j	                  d | |                    | j                  t              5   | |              d d d        | j	                  d | |                    y # 1 sw Y   'xY w)Nr   rd  r  r  c                        e Zd ZW  d        Zy)KInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.IAdaptc                      yr  r.   r  s     r   rN  zUInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.IAdapt.__adapt__ 	  r  r   Nr  r  s   r   IAdaptr  	       r   r  c                       e Zd ZdZy)LInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.ISimplezNothing special.Nr  r.   r   r   rL  r  $	  s    "r   rL  c                       e Zd Zd Zy)NInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.Conform24c                      yN   r.   rJ  s     r   r-  zZInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.Conform24.__conform__)	  s    r   Nr.  r.   r   r   	Conform24r  '	  s    r   r  c                       e Zd Zd Zy)PInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.ConformNonec                      y r   r.   rJ  s     r   r-  z\InterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.ConformNone.__conform__.	  r   r   Nr.  r.   r   r   ConformNoner  ,	  s    r   r  r   r  )r   re  r  r  r#   r   r^   r  )r%   re  r  r  rL  r  r  r  s          @r   ,test___call___w_overridden_adapt_and_conformz;InterfaceTests.test___call___w_overridden_adapt_and_conform	  s     	-.2	Y 	
	#i 	# 
V		 	 
	 
V		 	 
	 	VFH-.WY[12VIK01y) 	#KM"	# 	VKM23	# 	#s   C99Dc                     dd l }ddlm} ddlm} ddlm  G fdd|      } ||       G d d             }| j                  d	 |t                             |       }| j                  | ||             y )
Nr   rd  r  r  c                   ,     e Zd ZW  fd       Z xZS )HInterfaceTests.test___call___w_overridden_adapt_call_super.<locals>.IFooc                 F    | j                  |      syt        | 	  |      S r  )r   superrN  )r%   r   r  s     r   rN  zRInterfaceTests.test___call___w_overridden_adapt_call_super.<locals>.IFoo.__adapt__D	  s"    s+w(--r   )r   r   r   rN  __classcell__)r  r  s   @r   r  r  B	  s    . .r   r  c                       e Zd Zy)GInterfaceTests.test___call___w_overridden_adapt_call_super.<locals>.ObjNr   r.   r   r   r  r  J	  r  r   r  r   )sysr   re  r  r  r#   r   r   )r%   r  re  r  r  r  r   r  s          @r   +test___call___w_overridden_adapt_call_superz:InterfaceTests.test___call___w_overridden_adapt_call_super;	  sj    ,.2	.9 	. 
T		 	 
	 	T&(^,ec49%r   c                     ddl m} ddl m  G fdd|      }| j                  d |t	                            | j                  |d   j                         d       y )	Nr   rd  r  c                   &    e Zd ZW  d        Zd Zy)HInterfaceTests.test___adapt___as_method_and_implementation.<locals>.IFooc                      yr  r.   r  s     r   rN  zRInterfaceTests.test___adapt___as_method_and_implementation.<locals>.IFoo.__adapt__W	  r  r   c                      y)zThis is a protocolNr.   )to_adapts    r   rN  zRInterfaceTests.test___adapt___as_method_and_implementation.<locals>.IFoo.__adapt__[	  r  r   Nr  r  s   r   r  r  V	  s     %r   r  r   rN  z
(to_adapt))r   re  r  r#   r   getSignatureStringr%   re  r  r  s      @r   +test___adapt___as_method_and_implementationz:InterfaceTests.test___adapt___as_method_and_implementationR	  sK    ,2	%9 	% 	T&(^,k*==?Nr   c                 &  	 ddl m} ddl m	  G d d|      } G 	fdd|      } G d d	|      } G d
 d|      } G d d|||      } G 	fdd|      }| j                  d |t	                            |||||fD ]"  }| j                  t
        |j                         $ |||fD ]&  }| j                  t        |      t        |             ( | j                  t        |      t        |             | j                  t        |      t        |             | j                  |t        |             | j                  d |t	                            | j                  t        |      t        |             | j                  |t        |             y )Nr   rd  r  c                       e Zd ZdZy)@InterfaceTests.test___adapt__inheritance_and_type.<locals>.IRootRootNr  r.   r   r   IRootr  e	  s    r   r  c                        e Zd ZW  d        Zy)EInterfaceTests.test___adapt__inheritance_and_type.<locals>.IWithAdaptc                      yr  r.   r  s     r   rN  zOInterfaceTests.test___adapt__inheritance_and_type.<locals>.IWithAdapt.__adapt__i	  r  r   Nr  r  s   r   
IWithAdaptr  h	  r  r   r  c                       e Zd ZdZy)AInterfaceTests.test___adapt__inheritance_and_type.<locals>.IOtherzSecond branchNr  r.   r   r   r  r  m	  s    r   r  c                       e Zd ZdZy)EInterfaceTests.test___adapt__inheritance_and_type.<locals>.IUnrelated	UnrelatedNr  r.   r   r   
IUnrelatedr  p	  s    r   r  c                       e Zd ZdZy)HInterfaceTests.test___adapt__inheritance_and_type.<locals>.IDerivedAdaptzInherits an adaptNr  r.   r   r   IDerivedAdaptr  s	  s    #r   r  c                   $    e Zd ZdZW  d        Zy)IInterfaceTests.test___adapt__inheritance_and_type.<locals>.IDerived2Adaptz$Overrides an inherited custom adapt.c                      yr  r.   r  s     r   rN  zSInterfaceTests.test___adapt__inheritance_and_type.<locals>.IDerived2Adapt.__adapt__y	  r  r   N)r   r   r   rR   rN  r  s   r   IDerived2Adaptr  w	  s    6 r   r  r   r  )
r   re  r  r#   r   r   r   r  r  rr  )
r%   re  r  r  r  r  r  r  r+  r  s
            @r   "test___adapt__inheritance_and_typez1InterfaceTests.test___adapt__inheritance_and_typea	  s]   ,2	I 		 	
	 U 	 	 		$J
F 	$	] 	 	]6845J
MI 	9EXu'7'78	9 FJ. 	;ET%[$y/:	; 	DOT*-=>j)4+>?j$y/:^FH56D0$}2EFnd=.ABr   c                     ddl m} ddl m  G fdd|      }| j                   ||       d       | j                  |j	                         d       y )Nr   rd  r  c                   2    e Zd ZW  d        ZW  d        Zy)<InterfaceTests.test_interfacemethod_is_general.<locals>.IFooc                      y)zReplace an existing methodr   r.   r  s     r   r  zEInterfaceTests.test_interfacemethod_is_general.<locals>.IFoo.__call__	  s     r   c                      yr  r.   r   s    r   this_is_newzHInterfaceTests.test_interfacemethod_is_general.<locals>.IFoo.this_is_new	  r  r   N)r   r   r   r  r  r  s   r   r  r  	  s)       r   r  r   )r   re  r  r#   r  r  s      @r   test_interfacemethod_is_generalz.InterfaceTests.test_interfacemethod_is_general	  sD    ,2		9 		 	dR())+R0r   N)7r   r   r   r  r  r  r  r  r  r!  r(  r9  rB  rG  rP  r^  rj  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r+  r9  rP  rT  rV  r`  rh  ro  rv  r|  r  r  r  r  r  r  r  r.   r   r   r  r    s   02 6D865:0B)1V="8(:,;
FA0A.6BpJ6*&8PD6*&8P-)+0+
DA,	?4	=5 &<-M^7@rD$2:N28=*F,'*'"
.
+12*(!4F&.O*CX1r   r  c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)AttributeTestsTestAttributec                     ddl m} |S )Nr   r  )r"   r  )r%   r  s     r   rJ   zAttributeTests._getTargetClass	  s    6r   c                     | j                         }t        |       |_        t        |      }| j	                  |j                  d      |       | j	                  |j                  dt        z   dz         |       y )N-<zope.interface.interface.Attribute object at z.AttributeTests.TestAttribute>)rN   r  r   reprr   
startswithendswithr   r%   r  rs      r   test__repr__w_interfacez&AttributeTests.test__repr__w_interface	  sc    :LLLHI1	
 	JJsX~(HHI1	
r   c                     | j                         }t        |      }| j                  |j                  d      |       | j                  |j	                  d      |       y )Nr  z TestAttribute>)rN   r  r   r  r  r  s      r   test__repr__wo_interfacez'AttributeTests.test__repr__wo_interface	  sK    LLLHI1	
 	

#45q9r   c                     | j                         }t        |       |_        t        |      }| j	                  |t
        dz          y )Nz.AttributeTests.TestAttribute)rN   r  r   r8  r#   r   r  s      r   test__str__w_interfacez%AttributeTests.test__str__w_interface	  s8    :KH'FFGr   c                 ^    | j                         }t        |      }| j                  |d       y )Nr  )rN   r8  r#   r  s      r   test__str__wo_interfacez&AttributeTests.test__str__wo_interface	  s&    KO,r   N)	r   r   r   rL   rJ   r  r  r  r  r.   r   r   r  r  	  s!    "L	
:H-r   r  c                   ^    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zy)MethodTests
TestMethodc                     ddl m} |S )Nr   r`  )r"   ra  )r%   ra  s     r   rJ   zMethodTests._getTargetClass	  s
    3r   c                     | j                         }| j                  |j                  i        ddi|_        | j                  |j                  ddi       |`| j                  |j                  i        y rc   )rN   r#   r  r%   r  s     r   test_optional_as_propertyz%MethodTests.test_optional_as_property	  s]    "- %.5%.9O"-r   c                 
   ddl m} | j                         }	  |        | j                  d       y # |$ rL}| j	                  |j
                  d        | j	                  |j                  | j                         Y d }~y d }~ww xY w)Nr   )BrokenImplementationz*__call__ should raise BrokenImplementation)r  r  rN   r  r#   r   rM   rL   )r%   r  r  r  s       r   )test___call___raises_BrokenImplementationz5MethodTests.test___call___raises_BrokenImplementation	  sm    B	DH
 IIBC	 $ 	8Q[[$/QVVT%6%677	8s   1 BAA==Bc                 :   | j                         }|j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d        | j                  |d   d        y )N
positionalrequiredr  varargskwargs)rN   getSignatureInfor#   rT   )r%   r  infos      r   test_getSignatureInfo_barez&MethodTests.test_getSignatureInfo_bare	  s    &&(d<0126d:./4j)2.i$/h.r   c                 d    | j                         }| j                  |j                         d       y )Nz())rN   r#   r  r  s     r   test_getSignatureString_barez(MethodTests.test_getSignatureString_bare	  s&    224d;r   c                     | j                         }dgx|_        |_        | j                  |j	                         d       y )Nrd   z(foo))rN   r  r  r#   r  r  s     r   'test_getSignatureString_w_only_requiredz3MethodTests.test_getSignatureString_w_only_required	  s7    /4g5FO224g>r   c                     | j                         }dgx|_        |_        ddi|_        | j	                  |j                         d       y )Nrd   r6   z(foo='bar'))rN   r  r  r  r#   r  r  s     r   "test_getSignatureString_w_optionalz.MethodTests.test_getSignatureString_w_optional	  sB    /4g5FO %.224mDr   c                 r    | j                         }d|_        | j                  |j                         d       y )Nr   z(*args))rN   r  r#   r  r  s     r   !test_getSignatureString_w_varargsz-MethodTests.test_getSignatureString_w_varargs	  s-    224i@r   c                 r    | j                         }d|_        | j                  |j                         d       y )Nr   z(**kw))rN   r  r#   r  r  s     r    test_getSignatureString_w_kwargsz,MethodTests.test_getSignatureString_w_kwargs	  s-    224h?r   c                     | j                         }d|_        t        |       |_        t	        |      }| j                  |j                  d      |       | j                  |j                  dt        z   dz         |       y )Nr   *<zope.interface.interface.Method object atr  z.MethodTests.TestMethod(**kw)>)	rN   r  r  r   r  r   r  r  r   r  s      r   r  z#MethodTests.test__repr__w_interface
  sj    :LLLEF	
 	JJsX~(HHI1	
r   c                     | j                         }d|_        t        |      }| j                  |j	                  d      |       | j                  |j                  d      |       y )Nr   r
  z TestMethod(**kw)>)rN   r  r  r   r  r  r  s      r   r  z$MethodTests.test__repr__wo_interface
  sR    LLLEF	
 	

#78!<r   c                     | j                         }d|_        t        |       |_        t	        |      }| j                  |t        dz          y )Nr   z.MethodTests.TestMethod(**kw))rN   r  r  r   r8  r#   r   r  s      r   r  z"MethodTests.test__str__w_interface
  s?    :KH'FFGr   c                 l    | j                         }d|_        t        |      }| j                  |d       y )Nr   zTestMethod(**kw))rN   r  r8  r#   r  s      r   r  z#MethodTests.test__str__wo_interface 
  s.    K./r   N)r   r   r   rL   rJ   r  r  r  r   r  r  r  r  r  r  r  r  r.   r   r   r  r  	  sM    L.	D/<?
EA
@


=H0r   r  c                   H    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)Test_fromFunctionc                     ddl m}  ||i |S )Nr   r  )r"   r  )r%   r   r   r  s       r   _callFUTzTest_fromFunction._callFUT)
  s    9T(R((r   c                 L   d }| j                  |      }| j                  |j                         d       | j                  |j                         d       | j                  |j                  d        | j                  t        |j                               g        |j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d        | j                  |d   d        y )	Nc                       yr  r.   r.   r   r   _funcz*Test_fromFunction.test_bare.<locals>._func/
  r  r   r  r  r  r  r  r  r  r  r#   rQ   rS   r   rT   rU   r  r%   r  r  r  s       r   	test_barezTest_fromFunction.test_bare-
  s    	 u%)73+6))40f779:B?&&(d<0126d:./4j)2.i$/h.r   c                     ddl m}  G d d|      }d }| j                  ||      }| j                  |j                  |       y )Nr   r  c                       e Zd Zy)0Test_fromFunction.test_w_interface.<locals>.IFooNr   r.   r   r   r  r  A
  r   r   r  c                       yr  r.   r.   r   r   r  z1Test_fromFunction.test_w_interface.<locals>._funcD
  r  r   r   )r"   r  r  r#   r   )r%   r  r  r  r  s        r   test_w_interfacez"Test_fromFunction.test_w_interface>
  s@    ;	> 		 u5))40r   c                 p    d }| j                  |d      }| j                  |j                         d       y )Nc                       yr  r.   r.   r   r   r  z,Test_fromFunction.test_w_name.<locals>._funcL
  r  r   anotherName)rM   )r  r#   rQ   )r%   r  r  s      r   test_w_namezTest_fromFunction.test_w_nameJ
  s2    	 u=9)=9r   c                 F   d }| j                  |      }|j                         }| j                  t        |d         dg       | j                  t        |d         dg       | j                  |d   i        | j                  |d   d        | j                  |d   d        y )Nc                      yr  r.   rd   s    r   r  z5Test_fromFunction.test_w_only_required.<locals>._funcT
  r  r   r  rd   r  r  r  r  r  r  r#   rT   r  s       r   test_w_only_requiredz&Test_fromFunction.test_w_only_requiredR
  s    	 u%&&(d<01E7;d:./%9j)2.i$/h.r   c                 J   d	d}| j                  |      }|j                         }| j                  t        |d         dg       | j                  t        |d         g        | j                  |d   ddi       | j                  |d   d        | j                  |d   d        y )
Nr6   c                      yr  r.   r#  s    r   r  z0Test_fromFunction.test_w_optional.<locals>._funca
  r  r   r  rd   r  r  r  r  r6   r$  r  s       r   test_w_optionalz!Test_fromFunction.test_w_optional_
  s    	 u%&&(d<01E7;d:./4j)E5>:i$/h.r   c                 H   d	d}| j                  |d      }|j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d        | j                  |d   d        y )
Nc                      yr  r.   r   s    r   r  z5Test_fromFunction.test_w_optional_self.<locals>._funcu
  r  r   rn  )imlevelr  r  r  r  r  r(  r$  r  s       r   test_w_optional_selfz&Test_fromFunction.test_w_optional_selfl
  s    	 ua0&&(d<0126d:./4j)2.i$/h.r   c                 B   d }| j                  |      }|j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d       | j                  |d   d        y )Nc                       yr  r.   )r   s    r   r  z/Test_fromFunction.test_w_varargs.<locals>._func
  r  r   r  r  r  r  r   r  r$  r  s       r   test_w_varargsz Test_fromFunction.test_w_varargs
  s    	 u%&&(d<0126d:./4j)2.i&1h.r   c                 B   d }| j                  |      }|j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d        | j                  |d   d       y )Nc                       yr  r.   )r   s    r   r  z.Test_fromFunction.test_w_kwargs.<locals>._func
  r  r   r  r  r  r  r  r   r$  r  s       r   test_w_kwargszTest_fromFunction.test_w_kwargs
  s    	 u%&&(d<0126d:./4j)2.i$/h.r   c                 P   	 dd}| j                  |      }|j                         }| j                  t        |d         ddg       | j                  t        |d         dg       | j                  |d   ddi       | j                  |d   d	       | j                  |d
   d       y )Nr7   c                      yr  r.   )rd   r6   r   r   s       r   r  z3Test_fromFunction.test_full_spectrum.<locals>._func
  r  r   r  rd   r6   r  r  r  r   r  r   r7   r$  r  s       r   test_full_spectrumz$Test_fromFunction.test_full_spectrum
  s     	
 u%&&(d<01E5>Bd:./%9j)E5>:i&1h.r   N)r   r   r   r  r  r  r   r%  r)  r-  r0  r3  r7  r.   r   r   r  r  '
  s4    )/"
1:///(///r   r  c                   $    e Zd Zd Zd Zd Zd Zy)Test_fromMethodc                     ddl m}  ||i |S )Nr   )
fromMethod)r"   r;  )r%   r   r   r;  s       r   r  zTest_fromMethod._callFUT
  s    74&2&&r   c                 n    G d d      }| j                  |j                        }| j                  |j                         d       | j                  |j	                         d       | j                  |j
                  d        | j                  t        |j                               g        |j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d        | j                  |d	   d        y )
Nc                       e Zd Zd Zy))Test_fromMethod.test_no_args.<locals>.Fooc                      yr  r.   r   s    r   r6   z-Test_fromMethod.test_no_args.<locals>.Foo.bar
  r  r   Nr  r.   r   r   r   r>  
  rK  r   r   r6   r  r  r  r  r  r  )	r  r6   r#   rQ   rS   r   rT   rU   r  r%   r   r  r  s       r   test_no_argszTest_fromMethod.test_no_args
  s    	 	 sww')51+6))40f779:B?&&(d<0126d:./4j)2.i$/h.r   c                 n    G d d      }| j                  |j                        }|j                         }| j                  t	        |d         ddg       | j                  t	        |d         dg       | j                  |d   ddi       | j                  |d	   d
       | j                  |d   d       y )Nc                       e Zd Z	 ddZy)/Test_fromMethod.test_full_spectrum.<locals>.Fooc                      yr  r.   )r%   rd   r6   r   r   s        r   r6   z3Test_fromMethod.test_full_spectrum.<locals>.Foo.bar
  r  r   Nr6  r  r.   r   r   r   rD  
  s
    $r   r   r  rd   r6   r  r  r7   r  r   r  r   )r  r6   r  r#   rT   r@  s       r   r7  z"Test_fromMethod.test_full_spectrum
  s    	 	 sww'&&(d<01E5>Bd:./%9j)E5>:i&1h.r   c                 L   d }| j                  |      }| j                  |j                         d       | j                  |j                         d       | j                  |j                  d        | j                  t        |j                               g        |j                         }| j                  t        |d         g        | j                  t        |d         g        | j                  |d   i        | j                  |d   d        | j                  |d   d        y )	Nc                       yr  r.   r.   r   r   rd   z.Test_fromMethod.test_w_non_method.<locals>.foo
  r  r   rd   r  r  r  r  r  r  r  )r%   rd   r  r  s       r   test_w_non_methodz!Test_fromMethod.test_w_non_method
  s    	 s#)51+6))40f779:B?&&(d<0126d:./4j)2.i$/h.r   N)r   r   r   r  rA  r7  rH  r.   r   r   r9  r9  
  s    '/$/ /r   r9  c                       e Zd Zd Zd Zy)ro  c                     g | _         y r   )r  r   s    r   r   zDummyDependent.__init__
  s	    r   c                 :    | j                   j                  |       y r   )r  rS  )r%   originally_changeds     r   r  zDummyDependent.changed
  s    /0r   N)r   r   r   r   r  r.   r   r   ro  ro  
  s    1r   ro  c                     ddl m} t        | dd       }t        | dd       }|$t        |t	        |            r||kD  s |d      y y y )Nr   rb  rd   r6   r  )r  rc  r$   
isinstancer  )r   rc  rd   r6   s       r   r  r  
  sT    1
#ud
#C
#ud
#C
:c495
 SyABB  6r   c                 V    ddl m} t        | dd       rt        | dd       s |d      y y )Nr   rb  rd   r6   r  )r  rc  r$   )r   rc  s     r   r  r  
  s1    1sE4 eT)B)** *C 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   )r&  r$   
to_restoreitemssetattr)r%   r&  r   keyr3  s        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   )rR  rS  rT  r&  )r%   exc_typeexc_valexc_tbrU  r3  s         r   __exit__z_Monkey.__exit__  s2    ////1 	-JCDKKe,	-r   N)r   r   r   r   rW  r\  r.   r   r   r   r      s    (-r   r   c                       e Zd ZdZd Zd Zy)TestTypeAnnotationsz*Test using Interfaces in type annotations.c                     ddl m} ddl m} ddlm}  G d d|       G d d|       G fd	d
      }| j                  |j                  |   |f   d       y )Nr   OptionalUnionrd  c                       e Zd Zy)+TestTypeAnnotations.test___or__.<locals>.I1Nr   r.   r   r   r  re    r   r   r  c                       e Zd Zy)+TestTypeAnnotations.test___or__.<locals>.I2Nr   r.   r   r   r\  rg    r   r   r\  c                   6    e Zd ZU W  dz  ed<   W  W z  ed<   y)*TestTypeAnnotations.test___or__.<locals>.BNr   r   r   r   r   r  )r  r\  s   r   rL  ri    s    DyLBwJr   rL  r  typingra  rc  r   re  r#   r  )r%   ra  rc  re  rL  r  r\  s        @@r   test___or__zTestTypeAnnotations.test___or__  s[    # ,	 		 		 	 	Xb\b"fF	Hr   c                     ddl m} ddl m} ddlm}  G d d|       G d d       G fd	d
      }| j                  |j                  |   |f   d       y )Nr   r`  rb  rd  c                       e Zd Zy),TestTypeAnnotations.test___ror__.<locals>.I1Nr   r.   r   r   r  rp  ,  r   r   r  c                       e Zd Zy)+TestTypeAnnotations.test___ror__.<locals>.ANr   r.   r   r   rO  rr  /  r   r   rO  c                   6    e Zd ZU dW z  ed<   W  W z  ed<   y)+TestTypeAnnotations.test___ror__.<locals>.BNr   r   rj  )rO  r  s   r   rL  rt  2  s    byL2vIr   rL  r  rk  )r%   ra  rc  re  rL  rO  r  s        @@r   test___ror__z TestTypeAnnotations.test___ror__&  sY    # ,	 		 		 	 	Xb\aeE	Gr   N)r   r   r   rR   rm  ru  r.   r   r   r^  r^    s    4H&Gr   r^  ) rR   unittestzope.interface.testsr   r   r   r   r   ra  TestCaser   r0   rF   r   r   r   r   r  r@  rE  r]  r  r  r  r  r  r9  ro  r  r  r   r^  r.   r   r   <module>ry     s  $  ( 1 6 2 (CX&& CB!9x(( !9HG(8$$ G(T9H$5$5 9D	!!	!15< 15hh5 h5V1
? 1
h			"72H4E4E "7Jf
** f
Ru	1(++ u	1pP1X&& P1f$$-\ $-N]0. ]0@@/)) @/F7/h'' 7/t1 1
C+- - 'G(++ 'Gr   