
    eIe                       d Z ddl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      Z G d de      Z G d de      Z G d de      Z G d d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y).zTest Interface implementation
    N)MissingSomeAttrs)OptimizationTestMixin)CleanUpc                       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   	invariantTAGGED_DATAc                      t               NNotImplementedErrorargskws     E/usr/lib/python3/dist-packages/zope/interface/tests/test_interface.py_checkz,Test_invariant.test_w_single.<locals>._check'       %''    c                   "    e Zd Z W W         y))Test_invariant.test_w_single.<locals>.FooN__name__
__module____qualname__)r   r
   s   r   Foor   *   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=    68	(	 	 	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>._check4   r   r   c                      t               r   r   r   s     r   _another_checkz6Test_invariant.test_w_multiple.<locals>._another_check7   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+   :   s    fn%r   r   r   r    )r$   r   r   r)   r   r
   s      @@@r   test_w_multiplezTest_invariant.test_w_multiple0   sF    68	(	(	& 	& 	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   taggedValuer   c                   $    e Zd Z W  ddg       y)+Test_taggedValue.test_w_single.<locals>.FoobarbazNr   r1   s   r   r   r4   H   s    w'r   r   r5   r6   r!   r2   r   r"   r#   r$   r   r   r2   s      @r   r%   zTest_taggedValue.test_w_singleD   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   r1   r   c                   8    e Zd Z W  ddg        W  dd       y)-Test_taggedValue.test_w_multiple.<locals>.Foor5   r6   quxspamNr   r1   s   r   r   r;   R   s    w'v&r   r   r6   r=   r5   r<   r7   r8   s      @r   r,   z Test_taggedValue.test_w_multipleN   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   r1   r   c                   L    e Zd Z W  ddg        W  dd        W  dd       y)9Test_taggedValue.test_w_multiple_overwriting.<locals>.Foor5   r6   r<   r=   frobNr   r1   s   r   r   rA   ]   s#    w'v&v&r   r   rB   r=   r>   r7   r8   s      @r   test_w_multiple_overwritingz,Test_taggedValue.test_w_multiple_overwritingY   s6    88	' 	'
 	k48!'7	9r   N)r   r   r   r%   r,   rC   r-   r   r   r/   r/   B   s    +	:
9r   r/   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!   rH   )r$   rH   s     r   _getTargetClasszElementTests._getTargetClassj   s
    4r   Nc                 J    || j                   } | j                         |      S r   )DEFAULT_NAMErI   )r$   names     r   _makeOnezElementTests._makeOnen   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 )	rM   r"   r   rK   getName__doc__getDoclistgetTaggedValueTagsr$   elements     r   test_ctor_defaultszElementTests.test_ctor_defaultss   s    --/))4+<+<=*D,=,=>"-)2.g88:;R@r   c                     | j                  d      }| j                  |j                  d        | j                  |j                  d       y )Nz
An Element)rM   r"   r   rQ   rU   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)rM   assertRaisesKeyErrorgetTaggedValuerU   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foor5   )rM   r"   rS   getDirectTaggedValueTagssetTaggedValuerU   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[   rM   r"   queryTaggedValuerU   s     r   test_queryTaggedValue_missz'ElementTests.test_queryTaggedValue_miss   s(    --/11*=tDr   c                 h    | j                         }| j                  |j                  dd      d       y Nr\   r5   rh   rU   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[   )rM   r]   r^   getDirectTaggedValuerU   s     r   test_getDirectTaggedValue_missz+ElementTests.test_getDirectTaggedValue_miss   s%    --/(G$@$@*Mr   c                 f    | j                         }| j                  |j                  d      d        y r[   rM   r"   queryDirectTaggedValuerU   s     r    test_queryDirectTaggedValue_missz-ElementTests.test_queryDirectTaggedValue_miss   s(    --/77
CTJr   c                 h    | j                         }| j                  |j                  dd      d       y rl   rr   rU   s     r   *test_queryDirectTaggedValue_miss_w_defaultz7ElementTests.test_queryDirectTaggedValue_miss_w_default   s*    --/77
EJERr   c                     | j                         }|j                  dd       | j                  t        |j	                               dg       | j                  |j                  d      d       | j                  |j                  d      d       y rb   )rM   re   r"   rS   rT   r_   ri   rU   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.interfacesrz   zope.interface.verifyr|   rM   )r$   rz   r|   rV   s       r   test_verifieszElementTests.test_verifies   s    66--/Xw'r   r   )r   r   r   rK   rI   rM   rW   rY   r`   rf   rj   rm   rp   rt   rv   rx   r   r-   r   r   rE   rE   f   sQ    L,
A8
HLEMNKSA(r   rE   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   rI   r$   s    r   rM   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   rM   _MonkeyassertFalser   object)r$   r   sbr   r   s       @r   test_providedBy_missz2GenericSpecificationBaseTests.test_providedBy_miss   sQ    ,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   rM   r   r   r   r   )r$   r   r   r   r   s       @r   test_implementedBy_missz5GenericSpecificationBaseTests.test_implementedBy_miss   sS    ,6]]_	Yn= 	9R--fh78	9 	9 	9r   N)r   r   r   r   rI   rM   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   rI   z&SpecificationBaseTests._getTargetClass   s    >  r   Nr   r   r   rI   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   rM   _impliedr   isOrExtendsr   r$   r   s     r   test___call___missz+SpecificationBasePyTests.test___call___miss   -    ]]_12r   c                 x    | j                         }t               }|i i|_        | j                   ||             y r   rM   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          ByHr   r   c                             S r   r-   r   r   s    r   r   zGSpecificationBasePyTests.test_implementedBy_hit.<locals>._implementedBy   
    7Nr   r   )r   r   rM   r   r   r   r   )r$   r   r   r   r   s      @@r   test_implementedBy_hitz/SpecificationBasePyTests.test_implementedBy_hit   sX    ,]]_	! 	!	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   rM   r   r   r   r   )r$   r   r   r   r   s      @@r   test_providedBy_hitz,SpecificationBasePyTests.test_providedBy_hit   sV    ,]]_	! 	!	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)rM   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$   rL   excRaisesErrorOnMissings      r   r   zrNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnMissing.__getattribute__  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 Nrc   )r   r   s    r   __init__ziNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.RaisesErrorOnModule.__init__  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     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   rc   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__5      r   N	r   r   r   r   __lt____le____gt____ge____ne__r-   r   r   AllowsAnyComparisonr   4  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   A  s     FFFFFFr   r   c                       e Zd Zy)XNameAndModuleComparisonTestsMixin.__check_NotImplemented_comparison.<locals>.MyExceptionNr   r-   r   r   MyExceptionr   N      r   r   )operatorr   r#   r"   r   r   r]   r   assertIsNotImplementedr   	TypeError	Exceptionr   )r$   rL   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__NotImplemented^      ..t4r   c                 &    | j                  d       y )Nler
  r   s    r   test__le__NotImplementedz:NameAndModuleComparisonTestsMixin.test__le__NotImplementeda  r  r   c                 &    | j                  d       y )Ngtr
  r   s    r   test__gt__NotImplementedz:NameAndModuleComparisonTestsMixin.test__gt__NotImplementedd  r  r   c                 &    | j                  d       y )Nger
  r   s    r   test__ge__NotImplementedz:NameAndModuleComparisonTestsMixin.test__ge__NotImplementedg  r  r   N)	r   r   r   r   r  r  r  r  r  r-   r   r   r   r     s"    'Un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   rI   z'InterfaceBaseTestsMixin._getTargetClassn  s    !!r   c                     ddl m} |S )Nr   )InterfaceBasePy)r!   r  )r$   r  s     r   r   z)InterfaceBaseTestsMixin._getFallbackClassq  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_conformx  s    t}$r   c                     S r   r-   )r$   r   object_should_provides     r   r   z7InterfaceBaseTestsMixin._makeOne.<locals>.IB.providedByz  s	    ,,r   N)r   r   r   r!  r   )r#  s   r   IBr  w  s    %-r   r$  r   )r$   r#  rL   moduler$  s    `   r   rM   z InterfaceBaseTestsMixin._makeOnev  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.  )rM   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)rM   rI   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)rM   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_raisesrM   r   s    r   6test___call___w_no_conform_catches_only_AttributeErrorzNInterfaceBaseTestsMixin.test___call___w_no_conform_catches_only_AttributeError  s    $$T4==?][r   )FNN)
r   r   r   rI   r   rM   r/  r4  r9  r=  r-   r   r   r  r  k  s&    "
 19=\r   r  c                       e Zd Zd Zy)InterfaceBaseTestsc                     ddl m} |S )Nr   )InterfaceBase)r!   rA  )r$   rA  s     r   rI   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.  rG        r   r.  )rM   r   )r$   r  r.  r2  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   )rM   r   r   	__adapt__)r$   r  r2  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   rM   r   r   r   rM  r"   )r$   r   r  r2  rT  rW  rS  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   rI   rK  rN  rZ  r-   r   r   rD  rD    s     .??O,6
7r   rD  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   rI   z"SpecificationTests._getTargetClass  rB  r   c                 h    |t         u r | j                                S  | j                         |      S r   )_markerrI   )r$   basess     r   rM   zSpecificationTests._makeOne  s4    G)4'')++%t##%e,,r   c                 p   ddl m} | j                         }| j                  |j                  d       | j                  t        |j                        d       | j                  ||j                  v        | j                  ||j                  v        | j                  t        |j                        d       y )Nr   	Interfacer-      )	r!   rd  rM   r"   	__bases__lenr   r   
dependents)r$   rd  specs      r   	test_ctorzSpecificationTests.test_ctor  s    6}},T]]+Q/-.	T]]23T__-q1r   c                     | j                         }t               }|j                  |       | j                  t	        |j
                        d       | j                  |j
                  |   d       y N   )rM   DummyDependent	subscriber"   rg  rh  r$   ri  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 )Nre  )rM   rn  ro  r"   rh  rp  s      r   test_subscribe_againz'SpecificationTests.test_subscribe_again  sF    }}ss-q1r   c                 z    | j                         }t               }| j                  t        |j                  |       y r   )rM   rn  r]   r^   unsubscriberp  s      r   test_unsubscribe_missz(SpecificationTests.test_unsubscribe_miss  s-    }}(D$4$4c:r   c                 8   | j                         }t               }|j                  |       |j                  |       |j                  |       | j	                  |j
                  |   d       |j                  |       | j                  ||j
                  v        y rl  )rM   rn  ro  rv  r"   rh  r   rp  s      r   test_unsubscribez#SpecificationTests.test_unsubscribe  sy    }}ss-q1/0r   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   rc  c                       e Zd Zy)VSpecificationTests.test___setBases_subscribes_bases_and_notifies_dependents.<locals>.INr   r-   r   r   Ir|    r   r   r}  c                       e Zd Zy)VSpecificationTests.test___setBases_subscribes_bases_and_notifies_dependents.<locals>.JNr   r-   r   r   Jr    r   r   r  rm  )
r!   rd  rM   rn  ro  rf  r"   _changedrh  get)r$   rd  ri  rq  r}  r  s         r   8test___setBases_subscribes_bases_and_notifies_dependentszKSpecificationTests.test___setBases_subscribes_bases_and_notifies_dependents  s    6}}s		 			 	v.d+Q/))$/6d+Q/r   c                    ddl m}  G d d|      }| j                         }d|_        d|j                  |<   |j                  |       | j                  |j                         | j                  ||j                  v        y )Nr   rc  c                       e Zd Zy)GSpecificationTests.test_changed_clears_volatiles_and_implied.<locals>.INr   r-   r   r   r}  r    r   r   r}  r   r-   )r!   rd  rM   _v_attrsr   changedassertIsNoner   )r$   rd  r}  ri  s       r   )test_changed_clears_volatiles_and_impliedz<SpecificationTests.test_changed_clears_volatiles_and_implied  sf    6		 	}}aT$--(dmm+,r   c                     ddl m}  G d d|      }| j                  ||g      }| j                  t	        |j                               |g       y )Nr   rc  c                       e Zd Zy)CSpecificationTests.test_interfaces_skips_already_seen.<locals>.IFooNr   r-   r   r   IFoor    r   r   r  )r!   rd  rM   r"   rS   
interfacesr$   rd  r  ri  s       r   "test_interfaces_skips_already_seenz5SpecificationTests.test_interfaces_skips_already_seen  sA    6	9 	}}dD\*doo/04&9r   c                     ddl m}  G d d|      }| j                  |      }| j                  |j	                  |d             y )Nr   rc  c                       e Zd Zy)<SpecificationTests.test_extends_strict_wo_self.<locals>.IFooNr   r-   r   r   r  r    r   r   r  Tstrict)r!   rd  rM   r   extendsr  s       r   test_extends_strict_wo_selfz.SpecificationTests.test_extends_strict_wo_self  s:    6	9 	}}T"d489r   c                 h    | j                         }| j                  |j                  |d             y )NTr  )rM   r   r  r$   ri  s     r   test_extends_strict_w_selfz-SpecificationTests.test_extends_strict_w_self  s(    }}d489r   c                 h    | j                         }| j                  |j                  |d             y )NFr  )rM   r   r  r  s     r   test_extends_non_strict_w_selfz1SpecificationTests.test_extends_non_strict_w_self  s&    }}T%89r   c                     | j                         }t               }d|i|_        | j                  |j	                  d      |u        y r   )rM   r   r  r   r  )r$   ri  rc   s      r   test_get_hit_w__v_attrsz*SpecificationTests.test_get_hit_w__v_attrs"  s8    }}h3./r   c                 <   ddl m ddl m}  G fdd|      } G fdd|      }| j                  ||g      }| j	                  |j                  d      |j                  d      u        | j	                  |j                  d	      |j                  d	      u        y )
Nr   	Attributerc  c                        e Zd Z W  d      Zy)CSpecificationTests.test_get_hit_from_base_wo__v_attrs.<locals>.IFoorc   N)r   r   r   rc   r  s   r   r  r  +      E"Cr   r  c                        e Zd Z W  d      Zy)CSpecificationTests.test_get_hit_from_base_wo__v_attrs.<locals>.IBarr5   Nr   r   r   r5   r  s   r   IBarr  -  r  r   r  rc   r5   )r!   r  rd  rM   r   r  )r$   rd  r  r  ri  r  s        @r   "test_get_hit_from_base_wo__v_attrsz5SpecificationTests.test_get_hit_from_base_wo__v_attrs(  su    66	#9 	#	#9 	#}}dD\*488E?:;488E?:;r   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   rc  implementerr   c                       e Zd Zy)TSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.IDefaultViewNameNr   r-   r   r   IDefaultViewNamer  =  r   r   r  c                       e Zd Zy)KSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.ContextNr   r-   r   r   Contextr  @  r   r   r  c                       e Zd Zy)LSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.RDBModelNr   r-   r   r   RDBModelr  C  r   r   r  c                       e Zd Zy)JSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.IOtherNr   r-   r   r   IOtherr  F  r   r   r  c                       e Zd Zy)MSpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.OtherBaseNr   r-   r   r   	OtherBaser  I      r   r  c                       e Zd Zy)ISpecificationTests.test_multiple_inheritance_no_interfaces.<locals>.ModelNr   r-   r   r   Modelr  M  r   r   r  )r!   rd  r   r  r   r"   __sro__r   )
r$   rd  r  r   r  r  r  r  r  r  s
             r   'test_multiple_inheritance_no_interfacesz:SpecificationTests.test_multiple_inheritance_no_interfaces3  s     	7;=	y 		 		w 		Y 	 
V		 	 
		Iw 	 	% ((e$i(g&f%
	
r   N)r   r   r   rI   r`  rM   rj  rr  rt  rw  ry  r  r  r  r  r  r  r  r  r  r-   r   r   r\  r\    sW     % -
222;
10 	-::::0	<'
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   rI   z#InterfaceClassTests._getTargetClass_  s    ;r   Nc                 6     | j                         |||||      S r   r   )r$   rL   ra  attrsrQ   r   s         r   rM   zInterfaceClassTests._makeOnec  s     %t##%dE5':NNr   c                    | j                         } |d      }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                         d       y )NITestingrO   r-   )rI   r"   r   rQ   rf  getBases)r$   klassinsts      r   rW   z&InterfaceClassTests.test_ctor_defaultsg  sl    $$&Z 
3r*,"-r   c                 f    | j                         }| j                  t        |dt               f       y )Nr  )rI   r]   r  r   )r$   r  s     r   test_ctor_bad_basesz'InterfaceClassTests.test_ctor_bad_baseso  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>._barv      r   r   rO   rc   r5   r  r  r-   )
r!   r  r  rI   r"   r   rQ   rf  nameskeys)r$   r  r  r  ATTRSr  r  s          r    test_ctor_w_attrs_attrib_methodsz4InterfaceClassTests.test_ctor_w_attrs_attrib_methodss  s    69	!%,$T* $$&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  rO   r-   rI   r"   r   rQ   rf  rS   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  rO   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  rO   r-   )	r!   r  rI   r"   r   rQ   rf  rS   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   rI   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 )NrQ   ATTRr  EXPLICIT)r  rQ   )rI   r"   rQ   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   )rM   r"   rS   r  rI  s     r   test_interfacesz#InterfaceClassTests.test_interfaces  s-    e..01E7;r   c                     | j                         }| j                  d|f      }| j                  |j                         |f       y NISub)ra  )rM   r"   r  r$   r*  subs      r   test_getBasesz!InterfaceClassTests.test_getBases  s9    mmF5(m3%2r   c                 d    | j                         }| j                  |j                  |             y r   )rM   r   isEqualOrExtendedByrI  s     r   !test_isEqualOrExtendedBy_identityz5InterfaceClassTests.test_isEqualOrExtendedBy_identity  s$    11%89r   c                     | j                         }| j                  d|f      }| j                  |j                  |             | j                  |j                  |             y r  )rM   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)rM   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   rO   r  r6   BazIBaser  IDerivedra  r  Fallr!   r  r  rM   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1)$/
 	% 4 }}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   rO   r  r  Tr  r5   rc   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	!%,$T* 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   rO   r  r6   r	  r
  r  r  r  Tr  r5   r6   rc   r  r  s           r   $test_names_w_all_True_w_bases_simplez8InterfaceClassTests.test_names_w_all_True_w_bases_simple  s    69	&ub1)$/
 	% 4 }}WJ}7--
4'-O$ 78:OPr   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>._bar  r  r   c                       yr  r-   r-   r   r   _foozJInterfaceClassTests.test_names_w_all_True_bases_w_same_names.<locals>._foo  r  r   r   rO   r  r	  rc   r6   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_names  s    69		&ub1)$/
 !-T 2 )% 4 }}WJ}7--
4'-O$ 78:OPr   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>._bar  r  r   c                       yr  r-   r-   r   r   r"  z/InterfaceClassTests.test___iter__.<locals>._foo   r  r   r   rO   r  r	  r#  r
  r  r  r  r  )r!   r  r  rM   r"   r  r$  s	            r   test___iter__z!InterfaceClassTests.test___iter__  s    69		&ub1)$/
 !-T 2 )% 4 }}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>._bar  r  r   r   rO   r  r6   r	  r
  r  r  r  Fr  r!   r  r  rM   r"   r  namesAndDescriptionsr  s           r   3test_namesAndDescriptions_w_all_False_ignores_baseszGInterfaceClassTests.test_namesAndDescriptions_w_all_False_ignores_bases  s    69	&ub1)$/
 	% 4 }}WJ}7--
4'-O < < < GH -"67 	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>._bar  r  r   r   rO   r  r  Fr  r5   rc   r,  r  s         r   -test_namesAndDescriptions_w_all_True_no_baseszAInterfaceClassTests.test_namesAndDescriptions_w_all_True_no_bases  sx    69	!%,$T* mm%m( 8 8U 8 CD %,/ %,/	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   rO   r  r6   r	  r
  r  r  r  Tr  r5   rc   r,  r  s           r   +test_namesAndDescriptions_w_all_True_simplez?InterfaceClassTests.test_namesAndDescriptions_w_all_True_simple*  s    69	&ub1)$/
 	% 4 }}WJ}7--
4'-O < < < FG *U"34 -"67 *U"34	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>._fooA  r  r   r   rO   r  r	  r#  r
  r  r  r  Tr  r5   r6   rc   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1)$/
 !-T 2 )% 4 }}WJ}7--
4'-O < < < FG *U"34 -"67 -"67	r   c                 f    | j                         }| j                  t        |j                  d       y r[   )rM   r]   r^   getDescriptionForr$   r  s     r   test_getDescriptionFor_missz/InterfaceClassTests.test_getDescriptionFor_missQ  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>._barX  r  r   r   rO   r  r  rc   r5   )r!   r  r  rM   r"   r:  r  s         r   test_getDescriptionFor_hitz.InterfaceClassTests.test_getDescriptionFor_hitU  sv    69	!%,$T* 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>._testc  s    z?"r   )rM   r]   r^   )r$   rB  r  s     @r   test___getitem___missz)InterfaceClassTests.test___getitem___missa  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>._barj  r  r   r   rO   r  r  rc   r5   )r!   r  r  rM   r"   r  s         r   test___getitem___hitz(InterfaceClassTests.test___getitem___hitg  sh    69	!%,$T* mm%m(UU5\2UU5\2r   c                 J    | j                         }| j                  d|v        y r[   )rM   r   r;  s     r   test___contains___missz*InterfaceClassTests.test___contains___misss  s     mmos*+r   c                     ddl m} ddl m} d } |dd       ||      d}| j                  |      }| j	                  d	|v        | j	                  d
|v        y )Nr   r  r  c                       yr  r-   r-   r   r   r  z7InterfaceClassTests.test___contains___hit.<locals>._barz  r  r   r   rO   r  r  rc   r5   )r!   r  r  rM   r   r  s         r   test___contains___hitz)InterfaceClassTests.test___contains___hitw  sX    69	!%,$T* mm%m(%%r   c                 f    | j                         }| j                  |j                  d      d        y r[   )rM   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   rO   r  r	  r#  r
  r  r  r  rc   r6   r5   )r!   r  r  rM   r"   rM  r$  s	            r    test_direct_hit_local_miss_basesz4InterfaceClassTests.test_direct_hit_local_miss_bases  s    69		&ub1)$/
 !-T 2 )% 4 }}WJ}7--
4'-O.e0DE.e0DE.5r   c                 f    | j                         }| j                  |j                  d      d        y r[   )rM   r"   queryDescriptionForrI  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  rM   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   rQ  )r   r   _called_withs     r   	_passablezCInterfaceClassTests.test_validateInvariants_pass.<locals>._passable  s    r
+r   r   )rM   r   re   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   rQ  r   r   _passable_called_withs     r   r^  zTInterfaceClassTests.test_validateInvariants_fail_wo_errors_passed.<locals>._passable      !(($4r   c                  .    j                  | |f       r   rQ  r   r   rc  _fail_called_withs     r   _failzPInterfaceClassTests.test_validateInvariants_fail_wo_errors_passed.<locals>._fail      $$dBZ0Mr   r   r  rc  rM   r   re   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                 \   ddl m g }g fd}| j                         }t               }|j	                  d|g       | j                  |j                  ||       | j                  |fi fg       | j                  t        |      d       | j                  t        |d                y )Nr   rb  c                  .    j                  | |f       r   rQ  ri  s     r   rk  zOInterfaceClassTests.test_validateInvariants_fail_w_errors_passed.<locals>._fail  rl  r   r   rm  r  rc  rM   r   re   r]   r_  r"   rg  r   
isinstance)r$   _errorsrk  r*  r   rc  rj  s        @@r   ,test_validateInvariants_fail_w_errors_passedz@InterfaceClassTests.test_validateInvariants_fail_w_errors_passed  s    5	 h\E73'5#;#;S'J*sfb\N;Wq)
71:w78r   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   rQ  re  s     r   r^  z\InterfaceClassTests.test_validateInvariants_fail_in_base_wo_errors_passed.<locals>._passable  rg  r   c                  .    j                  | |f       r   rQ  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_passed  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                  t        |d                y )	Nr   rb  c                  ,    j                  | |f       yr   rQ  re  s     r   r^  z[InterfaceClassTests.test_validateInvariants_fail_in_base_w_errors_passed.<locals>._passable  rg  r   c                  .    j                  | |f       r   rQ  ri  s     r   rk  zWInterfaceClassTests.test_validateInvariants_fail_in_base_w_errors_passed.<locals>._fail  rl  r   r
  r  r   rm  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_passed  s    5 "	 	 }}W%--
TG4hL5'2|i[9'7#=#=sGL.3&"?*sfb\N;Wq)
71:w78r   c                     g fd}t               }| j                  d      }|j                  d|g       | j                  d|f      }|j                  |       | j	                  dt                     y )Nc                  ,    j                  | |f       yr   rQ  re  s     r   r^  zbInterfaceClassTests.test_validateInvariants_inherited_not_called_multiple_times.<locals>._passable  rg  r   r
  r   r  rm  )r   rM   re   r_  r"   rg  )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)rM   r"   
__reduce__rI  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)rM   r"   hashrI  s     r   test___hash___normalz(InterfaceClassTests.test___hash___normal
  s4    h'e G H	I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  )rI   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 k         | j                  |d k         | j                  |d k(         | j                  |d k7         | j                  |d k\         | j                  |d kD         | j                  d |k         | j                  d |k         | j                  d |k(         | j                  d |k7         | j                  d |k\         | j                  d |kD         y r   rM   r   r   rI  s     r   test_comparison_with_Nonez-InterfaceClassTests.test_comparison_with_None  s    %&$'&$'&&''&&u%r   c                    | j                         }| j                  ||k         | j                  ||k         | j                  ||k(         | j                  ||k7         | j                  ||k\         | j                  ||kD         y r   )rM   r   r   rI  s     r   "test_comparison_with_same_instancez6InterfaceClassTests.test_comparison_with_same_instance)  ss    '''%(''r   c                 0   | j                  dd      }| j                  dd      }| j                  ||k         | j                  ||k         | j                  ||k         | j                  ||k         | j                  ||k(         | j                  ||k(         | j                  ||k7         | j                  ||k7         | j                  ||k\         | j                  ||k\         | j                  ||kD         | j                  ||kD         y )NINamezzope.interface.tests.oner   zzope.interface.tests.otherr  )r$   r  r   s      r   8test_comparison_with_same_named_instance_in_other_modulezLInterfaceClassTests.test_comparison_with_same_named_instance_in_other_module4  s    mmG0JmKg2NOe$%u%#&&#&u%%&%u%$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  H  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__L  s    !&))r   Nr   r   r   r  )r   s   r   MyInterfaceClassr  K  s    *r   r  r  rm  )	r  rI   rM   assertIsInstancer   typer]   r  	__class__)r$   r  r  r   s      @r   test_assignment_to__class__z/InterfaceClassTests.test_assignment_to__class__F  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   rc  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__c  s    r   Nr  r-   r   r   r  r  b  rJ  r   r  r  rm  )rm  c                       e Zd Zy)>InterfaceClassTests.test_assignment_to__class__2.<locals>.IBarNr   r-   r   r   r  r  i  r   r   r  c                       e Zd Zy)?InterfaceClassTests.test_assignment_to__class__2.<locals>.ISpamNr   r-   r   r   ISpamr  n  r   r   r  )r   rd  rI   r"   r]   r  r  )r$   rd  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)rM   r]   r   r   )r$   r  s     r   test__module__is_readonlyz-InterfaceClassTests.test__module__is_readonlyw  s7    }}~. 	10DO	1 	1 	1s	   7A )ITestr-   NNN)4r   r   r   rI   rM   rW   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QQ"A" $*G
E+
3,
&76&FK	7<"9<&9,89I&"	(%$.)4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                 x    ddl m} ddl m  G fdd|      }| j                  |d   j                  |u        y )Nr   rc  r  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   rd  r  r   r   )r$   rd  r  r  s      @r   !test_attributes_link_to_interfacez0InterfaceTests.test_attributes_link_to_interface  s2    ,,	( 	( 	6
,,23r   c                 f    ddl m}  G d d|      }| j                  |d   j                  |u        y )Nr   rc  c                       e Zd Zd Zy)9InterfaceTests.test_methods_link_to_interface.<locals>.I1c                      yzA methodNr-   )rc   r5   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   rd  r   r   )r$   rd  r  s      r   test_methods_link_to_interfacez-InterfaceTests.test_methods_link_to_interface  s.    ,	 	
 	8.."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	                   ||      v        | j                  | ||      v        | j	                   ||      v        | j                  | ||      v        y )Nr   rc  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.method1      )++r   c                     t               r   r   r  s      r   r  zCInterfaceTests.test_classImplements_simple.<locals>.Current.method2  r  r   N)r   r   r   __implemented__r  r  )r  s   r   Currentr    s    &O,,r   r  )r   rd  r   r   r   r   r"   )r$   rd  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,M'$::;=#99:Jw$778:g#667r   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	                   ||      v        | j                  | ||      v        | j	                   ||      v        | j                  | ||      v        y )Nr   rc  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.method  r  r   Nr  r-   r   r   r
  r         r   r
  c                       e Zd Zy)FInterfaceTests.test_classImplements_base_not_derived.<locals>.IDerivedNr   r-   r   r   r  r    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.method  r  r   Nr   r   r   r  r  )r
  s   r   r  r    s    #O,r   r  r   rd  r   r   r   r   )r$   rd  r   r   r  r  r  r
  s          @r   %test_classImplements_base_not_derivedz4InterfaceTests.test_classImplements_base_not_derived  s    ,0-	 I 	 	u 		, 	, )++G45//89w!778]7%;;<G!445Z%889r   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                  | ||      v        | j	                  | ||      j                         v        | j	                   ||      v        | j                  | ||      v        | j	                  | ||      j                         v        | j	                   ||      v        y )Nr   rc  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.method  r  r   Nr  r-   r   r   r
  r    r  r   r
  c                       e Zd Zy)FInterfaceTests.test_classImplements_base_and_derived.<locals>.IDerivedNr   r-   r   r   r  r    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.method  r  r   Nr  )r  s   r   r  r    s    &O,r   r  )r   rd  r   r   r   r   	flattened)r$   rd  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-"889w!7!A!A!CCDM'$::;*W"556G!4!>!>!@@AJw$778r   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	                   ||      v        | j	                  	 ||      v        | j	                   ||      v        | j	                  	 ||      v        y )Nr   rc  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        #O,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   rd  r   r   r   )
r$   rd  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t!445-"556D!112*T"223r   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	                   ||      v        | j                  	 ||      v        | j	                   ||      v        | j	                   ||      v        | j                  	 ||      v        | j	                   ||      v        y )Nr   rc  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$   rd  r   r   r  r  mixedr  r  r  r  r  s          @@@@@r   2test_classImplements_multiple_w_explict_implementszAInterfaceTests.test_classImplements_multiple_w_explict_implements  s6   ,0-	 I 	 
	U 		Y 		, 	,	% 	%	% 	%	JD% 	J ++E23--e45,,U34u!556=#778-"667E!223:e#445*U"334r   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   rc  FunInterfaceBarInterfaceBobInterfaceBazInterface)r   rd  r  r   r  r   )r$   rd  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  rc  )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.methodI  r  r   Nr   r   r   rW  r  r  s   r   ICheckMer)  F      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.methodP  r  r   Nr   r   r   r  rW  r  r,  s   r   CheckMer/  L      &OD,r   r4  )r   r  rd  r~   r'  r   )r$   rd  r'  r4  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  rc  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,  r9  [  r-  r   r,  c                       e Zd ZW  ZdZd Zy)1InterfaceTests.test_verifyObject.<locals>.CheckMer0  c                     t               r   r   r   s    r   r  z8InterfaceTests.test_verifyObject.<locals>.CheckMe.methode  r  r   Nr2  r3  s   r   r4  r<  a  r5  r   r4  )r   r  rd  r~   r|   r   )r$   rd  r|   r4  check_mer  r,  s        @@r   test_verifyObjectz InterfaceTests.test_verifyObjectU  s>    ,,6	y 		, 	, 9Xx89r   c                 f    ddl m}  G d d|      }| j                  |j                  |             y )Nr   rc  c                       e Zd Zy)LInterfaceTests.test_interface_object_provides_Interface.<locals>.AnInterfaceNr   r-   r   r   AnInterfacerB  o  r   r   rC  )r   rd  r   r   )r$   rd  rC  s      r   (test_interface_object_provides_Interfacez7InterfaceTests.test_interface_object_provides_Interfacel  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  rc  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   ISimplerG  y      Y'D r   rI  rW  r  r   r  rd  r"   r  r  r$   rd  rI  r  s      @r   test_names_simplez InterfaceTests.test_names_simplet  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  rc  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
  rP    rJ  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  rS    s    j)E  r   r  )rX  r  r  Tr  rW  rX  r  r  rK  r$   rd  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                  t        |d   d	                | j                  |d   d	   j                  d       | j                  |d   d	   j                  d
       | j                  |d	   d   d       | j                  t        |d	   d	   |             | j                  |d	   d	   j                  d       | j                  |d	   d	   j                  d       y )Nr   r  Methodrc  c                   &    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.method  r  r   Nr+  r  s   r   rI  r`        Y'Dr   rI  re  rW  rm  r  r  rc  )r   r  r!   r^  rd  r  r-  r"   rg  r   rr  r   rQ   )r$   r^  rd  rI  name_valuesr  s        @r    test_namesAndDescriptions_simplez/InterfaceTests.test_namesAndDescriptions_simple  s(   ,3,	i 	 W99;<[)1-Q*F3
;q>!#4i@AQ*33V<Q*22I>Q*H5
;q>!#4f=>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                  t        |d   d                | j                  |d   d   j                  d
       | j                  |d   d   j                  d       | j                  |d   d   d       | j                  t        |d   d   |             | j                  |d   d   j                  d       | j                  |d   d   j                  d       | j                  |d   d   d       | j                  t        |d   d   |             | j                  |d   d   j                  d       | j                  |d   d   j                  d       t        |j                  d            }| j                  t        |      d       | j                  |d   d   d       | j                  t        |d   d                | j                  |d   d   j                  d       | j                  |d   d   j                  d       | j                  |d   d   d
       | j                  t        |d   d                | j                  |d   d   j                  d
       | j                  |d   d   j                  d       | j                  |d   d   d       | j                  t        |d   d   |             | j                  |d   d   j                  d       | j                  |d   d   j                  d       | j                  |d	   d   d       | j                  t        |d	   d   |             | j                  |d	   d   j                  d       | j                  |d	   d   j                  d       y )Nr   r  rc  r]  c                   &    e Zd Z W  d      Zd Zy)?InterfaceTests.test_namesAndDescriptions_derived.<locals>.IBaser  c                       yrb  r-   r-   r   r   r  zFInterfaceTests.test_namesAndDescriptions_derived.<locals>.IBase.method  r  r   Nr+  r  s   r   r
  ri    rd  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)BInterfaceTests.test_namesAndDescriptions_derived.<locals>.IDerivedrT  c                       yMy method, overriddenNr-   r-   r   r   r  zIInterfaceTests.test_namesAndDescriptions_derived.<locals>.IDerived.method  r  r   c                       y
My method2Nr-   r-   r   r   r  zJInterfaceTests.test_namesAndDescriptions_derived.<locals>.IDerived.method2  r  r   NrW  r  s   r   r  rl        j)E(r   r     rX  rm  rT  r  ro  re  r  rr  Tr     rW  r  )r   r  rd  r!   r^  r  r-  r"   rg  r   rr  r   rQ   )r$   rd  r^  r
  r  re  r  s         @r   !test_namesAndDescriptions_derivedz0InterfaceTests.test_namesAndDescriptions_derived  s   ,,3	I 		u 	 X::<=[)1-Q*G4
;q>!#4i@AQ*33W=Q*22J?Q*H5
;q>!#4f=>Q*33X>Q*224KLQ*I6
;q>!#4f=>Q*33Y?Q*22LAX::t:DE[)1-Q*F3
;q>!#4i@AQ*33V<Q*22I>Q*G4
;q>!#4i@AQ*33W=Q*22J?Q*H5
;q>!#4f=>Q*33X>Q*224KLQ*I6
;q>!#4f=>Q*33Y?Q*22LAr   c                 h    ddl m}  G d d|      }| j                  t        |j                  d       y )Nr   rc  c                       e Zd Zy)IInterfaceTests.test_getDescriptionFor_nonesuch_no_default.<locals>.IEmptyNr   r-   r   r   IEmptyry    r   r   rz  r\   )r   rd  r]   r^   r:  r$   rd  rz  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                  t        |             | j                  |j                  d       | j                  |j                  d       |j                  d	      }| j                  t        ||             | j                  |j                  d	       | j                  |j                  d
       y )Nr   r  r]  rc  c                   &    e Zd Z W  d      Zd Zy)=InterfaceTests.test_getDescriptionFor_simple.<locals>.ISimpler  c                       yrb  r-   r-   r   r   r  zDInterfaceTests.test_getDescriptionFor_simple.<locals>.ISimple.method  r  r   Nr+  r  s   r   rI  r    rd  r   rI  rW  r  r  rc  r   r  r!   r^  rd  r:  r   rr  r"   r   rQ   r$   r^  rd  rI  a_descm_descr  s         @r   test_getDescriptionFor_simplez,InterfaceTests.test_getDescriptionFor_simple  s    ,3,	i 	 **62
6956&13**84
6623(35r   c                 ~  	 ddl m	 ddlm} ddl m}  G 	fdd|      } G 	fdd|      }|j                  d	      }| j                  t        |	             | j                  |j                  d	       | j                  |j                  d
       |j                  d      }| j                  t        ||             | j                  |j                  d       | j                  |j                  d       |j                  d      }| j                  t        |	             | j                  |j                  d       | j                  |j                  d       |j                  d      }| j                  t        ||             | j                  |j                  d       | j                  |j                  d       y )Nr   r  r]  rc  c                   &    e Zd Z W  d      Zd Zy)<InterfaceTests.test_getDescriptionFor_derived.<locals>.IBaser  c                       yrb  r-   r-   r   r   r  zCInterfaceTests.test_getDescriptionFor_derived.<locals>.IBase.method  r  r   Nr+  r  s   r   r
  r    rd  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)?InterfaceTests.test_getDescriptionFor_derived.<locals>.IDerivedrT  c                       yrn  r-   r-   r   r   r  zFInterfaceTests.test_getDescriptionFor_derived.<locals>.IDerived.method  r  r   c                       yrq  r-   r-   r   r   r  zGInterfaceTests.test_getDescriptionFor_derived.<locals>.IDerived.method2  r  r   NrW  r  s   r   r  r    rs  r   r  rW  r  r  ro  rX  rT  r  rr  r  
r$   r^  rd  r
  r  r  r  a2_descm2_descr  s
            @r   test_getDescriptionFor_derivedz-InterfaceTests.test_getDescriptionFor_derived	  sW   ,3,	I 		u 	 ++F3
6956&13++H5
6623(3)@A,,W5
7I67))73*5,,Y7
7F34))95,7r   c                 h    ddl m}  G d d|      }| j                  t        |j                  d       y )Nr   rc  c                       e Zd Zy)7InterfaceTests.test___getitem__nonesuch.<locals>.IEmptyNr   r-   r   r   rz  r  5  r   r   rz  r\   )r   rd  r]   r^   __getitem__r{  s      r   test___getitem__nonesuchz'InterfaceTests.test___getitem__nonesuch2  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                  t        |             | j                  |j                  d       | j                  |j                  d       |d	   }| j                  t        ||             | j                  |j                  d	       | j                  |j                  d
       y )Nr   r  r]  rc  c                   &    e Zd Z W  d      Zd Zy)6InterfaceTests.test___getitem__simple.<locals>.ISimpler  c                       yrb  r-   r-   r   r   r  z=InterfaceTests.test___getitem__simple.<locals>.ISimple.methodC  r  r   Nr+  r  s   r   rI  r  @  rd  r   rI  rW  r  r  rc  
r   r  r!   r^  rd  r   rr  r"   r   rQ   r  s         @r   test___getitem__simplez%InterfaceTests.test___getitem__simple:  s    ,3,	i 	 
6956&13"
6623(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                  t        |	             | j                  |j                  d	       | j                  |j                  d
       |d   }| j                  t        ||             | j                  |j                  d       | j                  |j                  d       |d   }| j                  t        |	             | j                  |j                  d       | j                  |j                  d       |d   }| j                  t        ||             | j                  |j                  d       | j                  |j                  d       y )Nr   r  r]  rc  c                   &    e Zd Z W  d      Zd Zy)6InterfaceTests.test___getitem___derived.<locals>.IBaser  c                       yrb  r-   r-   r   r   r  z=InterfaceTests.test___getitem___derived.<locals>.IBase.methodY  r  r   Nr+  r  s   r   r
  r  V  rd  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)9InterfaceTests.test___getitem___derived.<locals>.IDerivedrT  c                       yrn  r-   r-   r   r   r  z@InterfaceTests.test___getitem___derived.<locals>.IDerived.method_  r  r   c                       yrq  r-   r-   r   r   r  zAInterfaceTests.test___getitem___derived.<locals>.IDerived.method2b  r  r   NrW  r  s   r   r  r  \  rs  r   r  rW  r  r  ro  rX  rT  r  rr  r  r  s
            @r   test___getitem___derivedz'InterfaceTests.test___getitem___derivedP  s?   ,3,	I 		u 	 &!
6956&13(#
6623(3)@A7#
7I67))73*59%
7F34))95,7r   c                 L    ddl m}  G d d|      }| j                  d|v        y )Nr   rc  c                       e Zd Zy)8InterfaceTests.test___contains__nonesuch.<locals>.IEmptyNr   r-   r   r   rz  r  |  r   r   rz  r\   )r   rd  r   r{  s      r   test___contains__nonesuchz(InterfaceTests.test___contains__nonesuchy  s&    ,	Y 	 	v-.r   c                     ddl m ddl m}  G fdd|      }| j                  d|v        | j                  d|v        y )Nr   r  rc  c                   &    e Zd Z W  d      Zd Zy)7InterfaceTests.test___contains__simple.<locals>.ISimpler  c                       yrb  r-   r-   r   r   r  z>InterfaceTests.test___contains__simple.<locals>.ISimple.method  r  r   Nr+  r  s   r   rI  r    rd  r   rI  rW  r  r   r  rd  r   rL  s      @r   test___contains__simplez&InterfaceTests.test___contains__simple  s9    ,,	i 	 	')*G+,r   c                     ddl m ddl m}  G fdd|      } G fdd|      }| j                  d|v        | j                  d	|v        | j                  d
|v        | j                  d|v        y )Nr   r  rc  c                   &    e Zd Z W  d      Zd Zy)6InterfaceTests.test___contains__derived.<locals>.IBaser  c                       yrb  r-   r-   r   r   r  z=InterfaceTests.test___contains__derived.<locals>.IBase.method  r  r   Nr+  r  s   r   r
  r    rd  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)9InterfaceTests.test___contains__derived.<locals>.IDerivedrT  c                       yrn  r-   r-   r   r   r  z@InterfaceTests.test___contains__derived.<locals>.IDerived.method  r  r   c                       yrq  r-   r-   r   r   r  zAInterfaceTests.test___contains__derived.<locals>.IDerived.method2  r  r   NrW  r  s   r   r  r    rs  r   r  rW  r  rX  r  r  rZ  s       @r   test___contains__derivedz'InterfaceTests.test___contains__derived  sg    ,,	I 		u 	 	(*+H,-8+,	X-.r   c                 \    ddl m}  G d d|      }| j                  t        |      g        y )Nr   rc  c                       e Zd Zy)1InterfaceTests.test___iter__empty.<locals>.IEmptyNr   r-   r   r   rz  r    r   r   rz  )r   rd  r"   rS   r{  s      r   test___iter__emptyz!InterfaceTests.test___iter__empty  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  rc  c                   &    e Zd Z W  d      Zd Zy)3InterfaceTests.test___iter__simple.<locals>.ISimpler  c                       yrb  r-   r-   r   r   r  z:InterfaceTests.test___iter__simple.<locals>.ISimple.method  r  r   Nr+  r  s   r   rI  r    rd  r   rI  rW  r  r   r  rd  r"   r  rS   rL  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  rc  c                   &    e Zd Z W  d      Zd Zy)2InterfaceTests.test___iter__derived.<locals>.IBaser  c                       yrb  r-   r-   r   r   r  z9InterfaceTests.test___iter__derived.<locals>.IBase.method  r  r   Nr+  r  s   r   r
  r    rd  r   r
  c                   ,    e Zd Z W  d      Zd Zd Zy)5InterfaceTests.test___iter__derived.<locals>.IDerivedrT  c                       yrn  r-   r-   r   r   r  z<InterfaceTests.test___iter__derived.<locals>.IDerived.method  r  r   c                       yrq  r-   r-   r   r   r  z=InterfaceTests.test___iter__derived.<locals>.IDerived.method2  r  r   NrW  r  s   r   r  r    rs  r   r  rY  r  rZ  s       @r   test___iter__derivedz#InterfaceTests.test___iter__derived  s@    ,,	I 		u 	 	X/?	Ar   c                 r    ddl m}  G d d|      }|d   }| j                  |j                  d      d       y )Nr   rc  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.method  r  r   rm  N)r   r   r   r  optionalr-   r   r   ITagMer    s     FOr   r  r  r  rm  )r   rd  r"   r_   )r$   rd  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   rc  c                       e Zd ZdZy)@InterfaceTests.test___doc___non_element.<locals>.IHaveADocStringxxxNr   r   r   rQ   r-   r   r   IHaveADocStringr        r   r  r  )r   rd  r"   rQ   rS   )r$   rd  r  s      r   test___doc___non_elementz'InterfaceTests.test___doc___non_element  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  rc  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    s    	*Gr   r  rO   rQ   )r   r  rd  r"   rQ   rS   )r$   rd  r  r  s      @r   test___doc___as_elementz&InterfaceTests.test___doc___as_element  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   rg  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  rc  directlyProvidesr	   c                   D    e Zd Z W  d      Z W  d      Z W e       y)8InterfaceTests.test_invariant_simple.<locals>.IInvariantrc   *bar; must eval to Boolean True if foo doesNr   r   r   rc   r5   _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      *   rm  If Foo, then Bar!)r   r  rd  r  r
   r"   r_   r  r_  r5   rc   r  )r$   rd  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  rc  r  r	   c                   D    e Zd Z W  d      Z W  d      Z W e       y)8InterfaceTests.test_invariant_nested.<locals>.IInvariantrc   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  rm  r  re  %Please, Boo MUST be greater than Foo!)r   r  rd  r  r
   r"   r_   r  rc   r  r5   r_  )	r$   rd  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  rc  r  r	   c                   D    e Zd Z W  d      Z W  d      Z W e       y):InterfaceTests.test_invariant_mutandis.<locals>.IInvariantrc   r  Nr  r  s   r   r  r  V  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   rm  r  re  r  )r   r  rd  r  r
   rc   r_   rR  r  re   r  r5   r"   r_  )
r$   rd  r  r  r  r  old_invariantsr   r  r
   s
           @@r   test_invariant_mutandisz&InterfaceTests.test_invariant_mutandisP  s5   ,,3,	% 	%
	 	 %
3 $22<@#A&
,-!!,
; 	--@,A$	& -BCZ	Q -.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   rc  r  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  rO   rQ   )r   rd  r  r"   rQ   rS   )r$   rd  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   rc  r  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_invariant  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__  s    %(#"$(r   Nr   r-   r   r   Ranger#    s    .r   r%  rm  re  r  )
r   rd  r  r  r
   r  rc  r_  r"   r7  )	r$   rd  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  rc  r1   c                   F    e Zd Z W  d      Z W  d      Z W dd       y)0InterfaceTests.test_taggedValue.<locals>.ITaggedrc   r  r<   SpamN)r   r   r   rc   r5   r  r2   s   r   ITaggedr)    s"    E"CHICv&r   r,  c                   6    e Zd Z W  dd        W  dd       y)1InterfaceTests.test_taggedValue.<locals>.IDerivedr<   	Spam Spamrc   r5   Nr   r1   s   r   r  r.    s    {+u%r   r  c                       e Zd Zy)2InterfaceTests.test_taggedValue.<locals>.IDerived2Nr   r-   r   r   	IDerived2r1    r   r   r2  r<   r*  rc   r/  r5   )r   r  rd  r2   r"   r_   r]   r^   rS   rT   set)r$   rd  r,  r  r2  r  r2   s        @@r   test_taggedValuezInterfaceTests.test_taggedValue  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   r1   r  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.FtagFNr   r   r   r8  r+  s   r   r9  r7        s#C.Cr   r9  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.Er8  ENr:  r+  s   r   r>  r=    r;  r   r>  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.Dr8  DNr:  r+  s   r   rA  r@    r;  r   rA  c                   4    e Zd Z W dd        W  d      Zy)0InterfaceTests._make_taggedValue_tree.<locals>.Cr8  CNr:  r+  s   r   rD  rC    r;  r   rD  c                       e Zd Zy)0InterfaceTests._make_taggedValue_tree.<locals>.BNr   r-   r   r   BrF    r   r   rG  c                       e Zd Zy)0InterfaceTests._make_taggedValue_tree.<locals>.ANr   r-   r   r   ArI    r   r   rJ  )r   r2   r  )r$   r  Or9  r>  rA  rD  rG  rJ  r  r2   s            @@r   _make_taggedValue_treez%InterfaceTests._make_taggedValue_tree  sc    .,	! 	!	! 	!	! 	!	!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   rc  rD  r8  rG  )r   rd  rL  r   r"   r8  r   r_   ri   rf  re   )r$   rd  class_Aiface_As       r   "test_getTaggedValue_follows__iro__z1InterfaceTests.test_getTaggedValue_follows__iro__  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   rc  r8  rJ  rm  rD  )r   rd  rL  r  rs   r"   rS   rd   r]   r^   ro   re   rf  r   )r$   rd  rJ  rD  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
      u        |f|_        | j                  |j	                  d
      d u        y )Nr   rc  r  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  rU    s    #Ar   r  c                       e Zd Zy)<InterfaceTests.test_description_cache_management.<locals>.I2Nr   r-   r   r   I2rW    r   r   rX  c                       e Zd Zy)<InterfaceTests.test_description_cache_management.<locals>.I3Nr   r-   r   r   I3rZ    r   r   r[  r   )r   rd  r  r   r  rf  )r$   rd  r  rX  r[  r  s        @r   !test_description_cache_managementz0InterfaceTests.test_description_cache_management  st     	-,	 		 		 	 	srvvc{23!|st+,r   c                     ddl m} ddl m}  G d d|      } ||       G d d             }| j                   | |             d       y )Nr   rc  r  c                       e Zd Zy)>InterfaceTests.test___call___defers_to___conform___.<locals>.INr   r-   r   r   r}  r_  '  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   rD  ra  *  s    r   rD  )r   rd  r  r"   )r$   rd  r  r}  rD  s        r   $test___call___defers_to___conform___z3InterfaceTests.test___call___defers_to___conform___#  sI    ,.		 	 
Q	 	 
	 	13#r   c                     ddl m} ddl m}  G d d|      } ||       G d d             } |       }| j                   ||      |u        y )Nr   rc  r  c                       e Zd Zy)9InterfaceTests.test___call___object_implements.<locals>.INr   r-   r   r   r}  rg  5  r   r   r}  c                       e Zd Zy)9InterfaceTests.test___call___object_implements.<locals>.CNr   r-   r   r   rD  ri  8  r  r   rD  )r   rd  r  r   )r$   rd  r  r}  rD  cs         r   test___call___object_implementsz.InterfaceTests.test___call___object_implements1  sN    ,.		 	 
Q	 	 
	 C!	"r   c                 v    ddl m}  G d d|      } G d d      } |       }| j                  t        ||       y )Nr   rc  c                       e Zd Zy)9InterfaceTests.test___call___miss_wo_alternate.<locals>.INr   r-   r   r   r}  rn  B  r   r   r}  c                       e Zd Zy)9InterfaceTests.test___call___miss_wo_alternate.<locals>.CNr   r-   r   r   rD  rp  E  r   r   rD  )r   rd  r]   r  r$   rd  r}  rD  rj  s        r   test___call___miss_wo_alternatez.InterfaceTests.test___call___miss_wo_alternate?  s6    ,		 		 	 C)Q*r   c                 |    ddl m}  G d d|      } G d d      } |       }| j                   |||       | u        y )Nr   rc  c                       e Zd Zy)8InterfaceTests.test___call___miss_w_alternate.<locals>.INr   r-   r   r   r}  ru  N  r   r   r}  c                       e Zd Zy)8InterfaceTests.test___call___miss_w_alternate.<locals>.CNr   r-   r   r   rD  rw  Q  r   r   rD  )r   rd  r   rq  s        r   test___call___miss_w_alternatez-InterfaceTests.test___call___miss_w_alternateK  s;    ,		 		 	 C!T
d*+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	                   ||       u        ||d d  y # ||d d  w xY w)
Nr   rc  rX  c                      y r   r-   rV  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)6InterfaceTests.test___call___w_adapter_hook.<locals>.INr   r-   r   r   r}  r  a  r   r   r}  c                       e Zd Zy)6InterfaceTests.test___call___w_adapter_hook.<locals>.CNr   r-   r   r   rD  r  d  r   r   rD  )r   rd  r!   rY  r   )	r$   rd  rY  r{  r}  r}  rD  rj  old_adapter_hookss	   `        r   test___call___w_adapter_hookz+InterfaceTests.test___call___w_adapter_hookW  sz    ,:				 		 	 C)!,!4=a	1OOAaDDL)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   rc  interfacemethodr  c                        e Zd ZW  d        Zy):InterfaceTests.test___call___w_overridden_adapt.<locals>.Ic                      yNr  r-   r$   r   s     r   rM  zDInterfaceTests.test___call___w_overridden_adapt.<locals>.I.__adapt__w      r   Nr   r   r   rM  r  s   r   r}  r  u  s     r   r}  c                       e Zd Zy):InterfaceTests.test___call___w_overridden_adapt.<locals>.ONr   r-   r   r   rK  r  {  r  r   rK  r  )r   rd  r  r  r"   r   )r$   rd  r  r}  rK  r  s        @r    test___call___w_overridden_adaptz/InterfaceTests.test___call___w_overridden_adaptp  se    ,2.		 	 
Q	 	 
	 	Qvx[) 	QqsV$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   rc  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   rM  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   rI  r    s    "r   rI  c                       e Zd Zd Zy)NInterfaceTests.test___call___w_overridden_adapt_and_conform.<locals>.Conform24c                      yN   r-   rI  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-   rI  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   rd  r  r  r"   r   r]   r  )r$   rd  r  r  rI  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   rc  r  r  c                   ,     e Zd ZW  fd       Z xZS )EInterfaceTests.test___call___w_overridden_adapt_call_super.<locals>.Ic                 F    | j                  |      syt        | 	  |      S r  )r   superrM  )r$   r   r  s     r   rM  zOInterfaceTests.test___call___w_overridden_adapt_call_super.<locals>.I.__adapt__  s"    s+w(--r   )r   r   r   rM  __classcell__)r  r  s   @r   r}  r    s    . .r   r}  c                       e Zd Zy)EInterfaceTests.test___call___w_overridden_adapt_call_super.<locals>.ONr   r-   r   r   rK  r    r  r   rK  r  )sysr   rd  r  r  r"   r   r   )r$   r  rd  r  r}  rK  or  s          @r   +test___call___w_overridden_adapt_call_superz:InterfaceTests.test___call___w_overridden_adapt_call_super  si    ,2.	.	 	. 
Q	 	 
	 	Qvx[)Ca1r   c                     ddl m} ddl m  G fdd|      }| j                  d |t	                            | j                  |d   j                         d       y )	Nr   rc  r  c                   &    e Zd ZW  d        Zd Zy)EInterfaceTests.test___adapt___as_method_and_implementation.<locals>.Ic                      yr  r-   r  s     r   rM  zOInterfaceTests.test___adapt___as_method_and_implementation.<locals>.I.__adapt__  r  r   c                      y)zThis is a protocolNr-   )to_adapts    r   rM  zOInterfaceTests.test___adapt___as_method_and_implementation.<locals>.I.__adapt__  r  r   Nr  r  s   r   r}  r    s     %r   r}  r  rM  z
(to_adapt))r   rd  r  r"   r   getSignatureStringr$   rd  r}  r  s      @r   +test___adapt___as_method_and_implementationz:InterfaceTests.test___adapt___as_method_and_implementation  sJ    ,2	%	 	% 	Qvx[);::<lKr   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   rc  r  c                       e Zd ZdZy)@InterfaceTests.test___adapt__inheritance_and_type.<locals>.IRootRootNr  r-   r   r   IRootr    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   rM  zOInterfaceTests.test___adapt__inheritance_and_type.<locals>.IWithAdapt.__adapt__  r  r   Nr  r  s   r   
IWithAdaptr    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    s    r   r  c                       e Zd ZdZy)EInterfaceTests.test___adapt__inheritance_and_type.<locals>.IUnrelated	UnrelatedNr  r-   r   r   
IUnrelatedr    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    #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   rM  zSInterfaceTests.test___adapt__inheritance_and_type.<locals>.IDerived2Adapt.__adapt__  r  r   N)r   r   r   rQ   rM  r  s   r   IDerived2Adaptr    s    6 r   r  r  r  )
r   rd  r  r"   r   r   r   r  assertNotEqualr  )
r$   rd  r  r  r  r  r  r  r*  r  s
            @r   "test___adapt__inheritance_and_typez1InterfaceTests.test___adapt__inheritance_and_type  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   rc  r  c                   2    e Zd ZW  d        ZW  d        Zy)9InterfaceTests.test_interfacemethod_is_general.<locals>.Ic                      y)zReplace an existing methodr  r-   r  s     r   r  zBInterfaceTests.test_interfacemethod_is_general.<locals>.I.__call__  s     r   c                      yr  r-   r   s    r   this_is_newzEInterfaceTests.test_interfacemethod_is_general.<locals>.I.this_is_new	  r  r   N)r   r   r   r  r  r  s   r   r}  r    s)       r   r}  r  )r   rd  r  r"   r  r  s      @r   test_interfacemethod_is_generalz.InterfaceTests.test_interfacemethod_is_general  sA    ,2			 		 	4"%"-r   N)7r   r   r   r  r  r  r  r  r	  r  r%  r6  r?  rD  rM  r[  rf  rv  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r&  r4  rL  rP  rR  r\  rd  rk  rr  rx  r  r  r  r  r  r  r  r-   r   r   r  r  }  s   468>:,984B)5V="8*:.;FA2A07BrJ6,'8RD6,'8R/-/2+DA.	?4	=5 &<-M^3@jD"2:N2.=*F,-*$#
+
,12%(!4H,L*CX.r   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   rI   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>)rM   r  r   reprr   
startswithendswithr   r$   r  rs      r   test__repr__w_interfacez&AttributeTests.test__repr__w_interface	  s]    :L%TUWXY

3>4T#TUWXYr   c                     | j                         }t        |      }| j                  |j                  d      |       | j                  |j	                  d      |       y )Nr  z TestAttribute>)rM   r  r   r  r  r  s      r   test__repr__wo_interfacez'AttributeTests.test__repr__wo_interface	  sG    L%TUWXY

#45q9r   c                     | j                         }t        |       |_        t        |      }| j	                  |t
        dz          y )Nz.AttributeTests.TestAttribute)rM   r  r   r7  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  )rM   r7  r"   r  s      r   test__str__wo_interfacez&AttributeTests.test__str__wo_interface'	  s&    KO,r   N)	r   r   r   rK   rI   r  r  r  r  r-   r   r   r  r  	  s"    "LZ: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!   r^  )r$   r^  s     r   rI   zMethodTests._getTargetClass1	  s
    3r   c                     | j                         }| j                  |j                  i        ddi|_        | j                  |j                  ddi       |`| j                  |j                  i        y rb   )rM   r"   r  r$   r  s     r   test_optional_as_propertyz%MethodTests.test_optional_as_property5	  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  rM   r  r"   r   rL   rK   )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)rM   getSignatureInfor"   rS   )r$   r  infos      r   test_getSignatureInfo_barez&MethodTests.test_getSignatureInfo_bareH	  s    &&(d<0126d:./4j)2.i$/h.r   c                 d    | j                         }| j                  |j                         d       y )Nz())rM   r"   r  r  s     r   test_getSignatureString_barez(MethodTests.test_getSignatureString_bareQ	  s&    224d;r   c                     | j                         }dgx|_        |_        | j                  |j	                         d       y )Nrc   z(foo))rM   r  r  r"   r  r  s     r   'test_getSignatureString_w_only_requiredz3MethodTests.test_getSignatureString_w_only_requiredU	  s7    /4g5FO224g>r   c                     | j                         }dgx|_        |_        ddi|_        | j	                  |j                         d       y )Nrc   r5   z(foo='bar'))rM   r  r  r  r"   r  r  s     r   "test_getSignatureString_w_optionalz.MethodTests.test_getSignatureString_w_optionalZ	  sB    /4g5FO %.224mDr   c                 r    | j                         }d|_        | j                  |j                         d       y )Nr   z(*args))rM   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))rM   r  r"   r  r  s     r    test_getSignatureString_w_kwargsz,MethodTests.test_getSignatureString_w_kwargse	  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)>)	rM   r  r  r   r  r   r  r  r   r  s      r   r  z#MethodTests.test__repr__w_interfacej	  sd    :L%QRTUV

3>4T#TUWXYr   c                     | j                         }d|_        t        |      }| j                  |j	                  d      |       | j                  |j                  d      |       y )Nr   r  z TestMethod(**kw)>)rM   r  r  r   r  r  r  s      r   r  z$MethodTests.test__repr__wo_interfacer	  sN    L%QRTUV

#78!<r   c                     | j                         }d|_        t        |       |_        t	        |      }| j                  |t        dz          y )Nr   z.MethodTests.TestMethod(**kw))rM   r  r  r   r7  r"   r   r  s      r   r  z"MethodTests.test__str__w_interfacey	  s?    :KH'FFGr   c                 l    | j                         }d|_        t        |      }| j                  |d       y )Nr   zTestMethod(**kw))rM   r  r7  r"   r  s      r   r  z#MethodTests.test__str__wo_interface	  s.    K./r   N)r   r   r   rK   rI   r  r  r  r  r  r  r  r  r  r  r  r  r-   r   r   r  r  -	  sN    L.	D/<?
EA
@
Z=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"   rP   rR   r   rS   rT   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  	  r   r   r  c                       yr  r-   r-   r   r   r  z1Test_fromFunction.test_w_interface.<locals>._func	  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>._func	  r  r   anotherName)rL   )r  r"   rP   )r$   r  r  s      r   test_w_namezTest_fromFunction.test_w_name	  s0    	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-   rc   s    r   r  z5Test_fromFunction.test_w_only_required.<locals>._func	  r  r   r  rc   r  r  r  r  r  r  r"   rS   r  s       r   test_w_only_requiredz&Test_fromFunction.test_w_only_required	  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 )
Nr5   c                      yr  r-   r   s    r   r  z0Test_fromFunction.test_w_optional.<locals>._func	  r  r   r  rc   r  r  r  r  r5   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>._func	  r  r   rm  )imlevelr  r  r  r  r  r%  r!  r  s       r   test_w_optional_selfz&Test_fromFunction.test_w_optional_self	  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                 N   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 )Nr6   c                      yr  r-   )rc   r5   r   r   s       r   r  z3Test_fromFunction.test_full_spectrum.<locals>._func	  r  r   r  rc   r5   r  r  r  r   r  r   r6   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*  r-  r0  r4  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!   r8  )r$   r   r   r8  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   r5   z-Test_fromMethod.test_no_args.<locals>.Foo.bar	  r  r   Nr  r-   r   r   r   r;  	  rJ  r   r   r5   r  r  r  r  r  r  )	r  r5   r"   rP   rR   r   rS   rT   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$   rc   r5   r   r   s        r   r5   z3Test_fromMethod.test_full_spectrum.<locals>.Foo.bar
  r  r   Nr3  r  r-   r   r   r   rA  
  s    r   r   r  rc   r5   r  r  r6   r  r   r  r   )r  r5   r  r"   rS   r=  s       r   r4  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   rc   z.Test_fromMethod.test_w_non_method.<locals>.foo
  r  r   rc   r  r  r  r  r  r  r  )r$   rc   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  r>  r4  rE  r-   r   r   r6  r6  	  s    '/ 
//r   r6  c                       e Zd Zd Zd Zy)rn  c                     g | _         y r   )r  r   s    r   r   zDummyDependent.__init__(
  s	    r   c                 :    | j                   j                  |       y r   )r  rR  )r$   originally_changeds     r   r  zDummyDependent.changed+
  s    /0r   N)r   r   r   r   r  r-   r   r   rn  rn  &
  s    1r   rn  c                     ddl m} t        | dd       }t        | dd       }|$t        |t	        |            r||kD  s |d      y y y )Nr   rb  rc   r5   r  )r  rc  r#   rr  r  )r   rc  rc   r5   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  rc   r5   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   keyr0  s        r   r   z_Monkey.__init__C
  sR    @BC3 44C((* 	(JCFC'	( Ds   Ac                     | S r   r-   r   s    r   	__enter__z_Monkey.__enter__I
  s    r   c                 v    | j                   j                         D ]  \  }}t        | j                  ||        y r   )rN  rO  rP  r%  )r$   exc_typeexc_valexc_tbrQ  r0  s         r   __exit__z_Monkey.__exit__L
  s2    ////1 	-JCDKKe,	-r   N)r   r   r   r   rS  rX  r-   r   r   r   r   A
  s    (-r   r   )rQ   unittestzope.interface.testsr   r   r   r   r`  TestCaser   r/   rE   r   r   r   r   r  r?  rD  r\  r  r  r  r  r  r6  rn  r  r  r   r-   r   r   <module>r\     s{    1 6 (
(CX&& CB!9x(( !9HE(8$$ E(P9H$5$5 9<!:2!+5< +5\f5 f5R*\? *\Z0.!**72H4E4E 7>Z
** Z
z]1(++ ]1@L.X&& L.^$-\ -BW0. W0tk/)) k/\//h'' //b1 1
C+- -r   