
    fb              	          d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	  G d d	ee	ej                        Z G d
 dee	ej                        Z G d dee	ej                        Z G d dee	ej                        Z G d de      Z G d deeee	ej                        Z G d deeee	ej                        Z G d deeeej                        Z G d deeeej                        Z G d deej                        Z G d dee	ej                        Z G d dee	ej                        Z G d  d!ee	ej                        Z G d" d#ee	ej                        Z G d$ d%ee	ej                        Z G d& d'ee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 d0 d1e	e      Z G d2 d3e      Z  G d4 d5ee	eej                        Z! G d6 d7e!      Z" G d8 d9e"      Z# G d: d;ee	ej                        Z$ G d< d=ee	ej                        Z% G d> d?e%      Z&d@ Z'dA Z(dB Z)y)C    N)EqualityTestsMixin)LenTestsMixin)NumberTests)OrderableMissingValueMixin)OrderableTestsMixin)WrongTypeTestsMixinc                   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)
BytesTestsc                     ddl m} |S )Nr   )Bytes)zope.schema._fieldr   )selfr   s     u/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/zope/schema/tests/test__field.py_getTargetClasszBytesTests._getTargetClass%   
    ,    c                     ddl m} |S )Nr   )IBytes)zope.schema.interfacesr   )r   r   s     r   _getTargetInterfacezBytesTests._getTargetInterface)   
    1r   c                 @    ddl m} ddl m} | j                         ||gS Nr   )
IFromBytes)IFromUnicoder   r   r   r   r   r   r   s      r   _getTargetInterfaceszBytesTests._getTargetInterfaces-       57((*L*EEr   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y N          ? _makeOneassertAllRaiseWrongType_typeset	frozensetobjectr   fields     r   test_validate_wrong_typesz$BytesTests.test_validate_wrong_types2   F    $$KKEKH	r   c                 L    ddl m} | j                  || j                  d       y )Nr   ValidationErrorr"   default)r   r3   assertRaisesr'   )r   r3   s     r   test_validate_w_invalid_defaultz*BytesTests.test_validate_w_invalid_defaultA   s    :/4==#Fr   c                     | j                  d      }|j                  d       |j                  d       |j                  d       |j                  d        y )NFrequiredr      abc   abc
defr'   validater-   s     r   test_validate_not_requiredz%BytesTests.test_validate_not_requiredF   sB    u-sv{#tr   c                     ddl m} | j                         }|j                  d       |j                  d       |j                  d       | j	                  ||j                  d        y )Nr   RequiredMissingr   r;   r<   r   rB   r'   r>   r6   r   rB   r.   s      r   test_validate_requiredz!BytesTests.test_validate_requiredN   J    :sv{#/5>>4@r   c                 f    | j                         }| j                  t        |j                  d       y )N   )r'   r6   UnicodeEncodeErrorfromUnicoder   byts     r   test_fromUnicode_missz BytesTests.test_fromUnicode_missW   s$    mmo,coowGr   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y )Nr"   r   DEADBEEF   DEADBEEFr'   assertEqualrJ   rK   s     r   test_fromUnicode_hitzBytesTests.test_fromUnicode_hit[   s?    mmo-s35{Cr   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y Nr   rP   r'   rR   	fromBytesr-   s     r   test_fromByteszBytesTests.test_fromBytes`   ?    -s35{Cr   N)__name__
__module____qualname__r   r   r   r/   r7   r?   rE   rM   rS   rX   r%   r   r   r
   r
   !   s:    F
G
AHD
Dr   r
   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)
ASCIITestsc                     ddl m} |S )Nr   )ASCII)r   r`   )r   r`   s     r   r   zASCIITests._getTargetClassj   r   r   c                     ddl m} |S )Nr   )IASCII)r   rb   )r   rb   s     r   r   zASCIITests._getTargetInterfacen   r   r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y Nr   r#   r$   r%   r&   r-   s     r   r/   z$ASCIITests.test_validate_wrong_typesr   r0   r   c                 F    | j                         }|j                  d       y Nr"   r'   	_validate)r   ascs     r   test__validate_emptyzASCIITests.test__validate_empty   s    mmobr   c                 J   ddl m} | j                         }| j                  |      5 }|j	                  t        d             d d d        j                  }| j                  |j                  |       | j                  |j                  t        d             y # 1 sw Y   WxY w)Nr   InvalidValue   )r   rm   r'   r6   rh   chr	exceptionassertIsr.   rR   value)r   rm   ri   excinvalids        r   test__validate_non_empty_missz(ASCIITests.test__validate_non_empty_miss   sz    7mmo|, 	$MM#c(#	$ --gmmS)C1	$ 	$s   BB"c                 x    | j                         }t        d      D ]  }|j                  t        |              y )N   )r'   rangerh   ro   )r   ri   is      r   test__validate_non_empty_hitz'ASCIITests.test__validate_non_empty_hit   s0    mmos 	"AMM#a&!	"r   N)	rZ   r[   r\   r   r   r/   rj   ru   rz   r%   r   r   r^   r^   f   s     2"r   r^   c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
BytesLineTestsc                     ddl m} |S )Nr   )	BytesLine)r   r~   )r   r~   s     r   r   zBytesLineTests._getTargetClass       0r   c                     ddl m} |S )Nr   )
IBytesLine)r   r   )r   r   s     r   r   z"BytesLineTests._getTargetInterface       5r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   z#BytesLineTests._getTargetInterfaces   r   r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y r!   r&   r-   s     r   r/   z(BytesLineTests.test_validate_wrong_types   r0   r   c                     | j                  d      }|j                  d        |j                  d       |j                  d       |j                  d       y )NFr9   r   r;      r=   r-   s     r   r?   z)BytesLineTests.test_validate_not_required   sB    u-tsv{#r   c                     ddl m} | j                         }|j                  d       |j                  d       |j                  d       | j	                  ||j                  d        y )Nr   rA   r   r;   r   rC   rD   s      r   rE   z%BytesLineTests.test_validate_required   rF   r   c                 n   | j                         }| j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       y )Nr   Tr;   r   r<   Fr'   rR   
constraintr-   s     r   test_constraintzBytesLineTests.test_constraint   s    ))#.5))&148))&148))+6=))+6>r   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y rU   rV   r-   s     r   rX   zBytesLineTests.test_fromBytes   rY   r   N)rZ   r[   r\   r   r   r   r/   r?   rE   r   rX   r%   r   r   r|   r|      s-    F
$A?Dr   r|   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)ASCIILineTestsc                     ddl m} |S )Nr   )	ASCIILine)r   r   )r   r   s     r   r   zASCIILineTests._getTargetClass   r   r   c                     ddl m} |S )Nr   )
IASCIILine)r   r   )r   r   s     r   r   z"ASCIILineTests._getTargetInterface   r   r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y rd   r&   r-   s     r   r/   z(ASCIILineTests.test_validate_wrong_types   r0   r   c                     ddl m} | j                  d      }|j                  d        |j                  d       |j                  d       | j	                  ||j                  d       y )Nr   rl   Fr9   r"   abc   «Þ)r   rm   r'   r>   r6   )r   rm   r.   s      r   r?   z)ASCIILineTests.test_validate_not_required   sO    7u-tru,
Cr   c                     ddl m} ddl m} | j                         }|j	                  d       |j	                  d       | j                  ||j                  d       | j                  ||j                  d        y )Nr   rl   rA   r"   r   r   )r   rm   rB   r'   r>   r6   )r   rm   rB   r.   s       r   rE   z%ASCIILineTests.test_validate_required   sW    7:ru,
C/5>>4@r   c                 n   | j                         }| j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       y )Nr"   Tr   r   zabc
defFr   r-   s     r   r   zASCIILineTests.test_constraint   s    ))"-t4))%0$7))%0$7))*5t<))*5u=r   N)	rZ   r[   r\   r   r   r/   r?   rE   r   r%   r   r   r   r      s"    DA>r   r   c                      e Zd ZdZdZ eej                        Z eej                        Z e	d ej                  D              Z
 e	d ej                  D              Z e	d ej                  D              Zd Zd Zd Zd	 Zd
 Zd Zy)
FloatTestsg              c              #   2   K   | ]  }t        |        y wNfloat.0xs     r   	<genexpr>zFloatTests.<genexpr>  s     6q%(6   c              #   2   K   | ]  }t        |        y wr   r   r   s     r   r   zFloatTests.<genexpr>  s     >1eAh>r   c              #   2   K   | ]  }t        |        y wr   r   r   s     r   r   zFloatTests.<genexpr>  s     :E!H:r   c                     ddl m} |S )Nr   )Float)r   r   )r   r   s     r   r   zFloatTests._getTargetClass  r   r   c                     ddl m} |S )Nr   )IFloat)r   r   )r   r   s     r   r   zFloatTests._getTargetInterface  r   r   c                     | j                  d      }|j                  d        |j                  d       |j                  d       |j                  d       y )NFr9         $@(\?QI @@r=   r-   s     r   r?   z%FloatTests.test_validate_not_required  sB    u-ttty!r   c                     ddl m} | j                         }|j                  d       |j                  d       |j                  d       | j	                  ||j                  d        y )Nr   rA   r   r   r   rC   rD   s      r   rE   z!FloatTests.test_validate_required#  sJ    :tty!/5>>4@r   c                     | j                         }| j                  t        |j                  d       | j                  t        |j                  d       | j                  t        |j                  d       y )Nr"   r   z14.G)r'   r6   
ValueErrorrJ   r   flts     r   rM   z FloatTests.test_fromUnicode_miss+  sO    mmo*coos;*coov>*coow?r   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       y )N0r   z1.23gGz?z1.23e6g    2ArQ   r   s     r   rS   zFloatTests.test_fromUnicode_hit2  sX    mmo.41483Y?r   N)rZ   r[   r\   mvm_missing_valuemvm_defaultr   r   MINMAXtupleVALID	TOO_SMALLTOO_BIGr   r   r?   rE   rM   rS   r%   r   r   r   r   	  s    K

 C

 C6K$5$566E>(=(=>>I:k&9&9::G"A@@r   r   c                   <   e Zd Zej                  j	                         Zej                  j	                         Zd Zd Zd Z	d Z
d Z ej                  ddd      Z ej                  ddd	      Z ed
 dD              Z ed dD              Z ed dD              Zy)DatetimeTestsc                     ddl m} |S )Nr   )Datetime)r   r   )r   r   s     r   r   zDatetimeTests._getTargetClassC  
    /r   c                     ddl m} |S )Nr   )	IDatetime)r   r   )r   r   s     r   r   z!DatetimeTests._getTargetInterfaceG      4r   c                     ddl m} | j                         }| j                  ||j                  ddddg i t               t               t               |j                                y )Nr   dater"   r#   r$   r%   )	datetimer   r'   r(   r)   r*   r+   r,   todayr   r   r.   s      r   r/   z'DatetimeTests.test_validate_wrong_typesK  sR    !$$KKEKHJJL	r   c                     | j                  d      }|j                  d        |j                  t        j                  j                                y )NFr9   )r'   r>   r   nowr-   s     r   r?   z(DatetimeTests.test_validate_not_required\  s9    u-tx((,,./r   c                 n    ddl m} | j                  d      }| j                  ||j                  d        y )Nr   rA   Tr9   )r   rB   r'   r6   r>   rD   s      r   rE   z$DatetimeTests.test_validate_requireda  s+    :t,/5>>4@r     
   r#      c              #   J   K   | ]  }t        j                   d d|        ywr   r   Nr   r   s     r   r   zDatetimeTests.<genexpr>h  s     DX&&tR3D   !#      c              #   J   K   | ]  }t        j                   d d|        ywr   	   Nr   r   s     r   r   zDatetimeTests.<genexpr>i  s     Ex((q!4Er   c              #   J   K   | ]  }t        j                   d d|        ywr   r   r   s     r   r   zDatetimeTests.<genexpr>j  s     Ha8$$T2q1Hr   r#         r   N)rZ   r[   r\   r   r   r   r   r   r   r/   r?   rE   r   r   r   r   r   r   r%   r   r   r   r   :  s     !))--/##'')K"0
A
 (

D"a
(C
(

D"a
(CDVDEGEfEFIH<HIEr   r   c                   <   e Zd Zej                  j                         Zej                  j                         Zd Zd Z	d Z
d Zd Z ej                  ddd      Z ej                  ddd	      Z ed
 dD              Z ed dD              Z ed dD              Zy)	DateTestsc                     ddl m} |S )Nr   )Date)r   r   )r   r   s     r   r   zDateTests._getTargetClassv  
    +r   c                     ddl m} |S )Nr   )IDate)r   r   )r   r   s     r   r   zDateTests._getTargetInterfacez  
    0r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t               t        j                  j                                y r!   )r'   r(   r)   r*   r+   r,   r   r   r-   s     r   r/   z#DateTests.test_validate_wrong_types~  sX    $$KKEKH!!#	%r   c                     ddl m} | j                  d      }|j                  d        |j                  |j	                                y )Nr   r   Fr9   )r   r   r'   r>   r   r   s      r   r?   z$DateTests.test_validate_not_required  s3    !u-ttzz|$r   c                     ddl m} | j                         }|j                  t        j                  j                         j                                | j                  ||j                  d        y )Nr   rA   )r   rB   r'   r>   r   r   r   r6   rD   s      r   rE   z DateTests.test_validate_required  sJ    :x((,,.3356/5>>4@r   r   r   r#   r   c              #   J   K   | ]  }t        j                  d d|        ywr   r   r   r   s     r   r   zDateTests.<genexpr>  s     @AX]]4Q/@r   r   c              #   J   K   | ]  }t        j                  d d|        ywr   r   r   s     r   r   zDateTests.<genexpr>  s     AQx}}T1a0Ar   c              #   J   K   | ]  }t        j                  d d|        ywr   r   r   s     r   r   zDateTests.<genexpr>  s     D!8==r1-Dr   r   N)rZ   r[   r\   r   r   r   r   r   r   r   r/   r?   rE   r   r   r   r   r   r   r%   r   r   r   r   m  s     !++---%%'K% %A (--b!
$C
(--b!
$C@@AGA&ABID|DEEr   r   c                   z   e Zd Z ej                  d      Z ej                  d      Zd Zd Zd Z	d Z
 ej                  ej                        Z ej                  ej                        Z ed ej                  D              Z ed	 ej                   D              Z ed
 ej"                  D              Zy)TimedeltaTests   minutes   c                     ddl m} |S )Nr   )	Timedelta)r   r   )r   r   s     r   r   zTimedeltaTests._getTargetClass  r   r   c                     ddl m} |S )Nr   )
ITimedelta)r   r   )r   r   s     r   r   z"TimedeltaTests._getTargetInterface  r   r   c                     ddl m} | j                  d      }|j                  d        |j                   |d             y )Nr   	timedeltaFr9   r   r   )r   r   r'   r>   )r   r   r.   s      r   r?   z)TimedeltaTests.test_validate_not_required  s2    &u-ty,-r   c                     ddl m} ddlm} | j	                         }|j                   |d             | j                  ||j
                  d        y )Nr   r   rA   r   r   )r   r   r   rB   r'   r>   r6   )r   r   rB   r.   s       r   rE   z%TimedeltaTests.test_validate_required  s:    &:y,-/5>>4@r   c              #   H   K   | ]  }t        j                  |         ywr   Nr   r   r   s     r   r   zTimedeltaTests.<genexpr>  s     KA($$Q//K    "c              #   H   K   | ]  }t        j                  |         ywr   r   r   s     r   r   zTimedeltaTests.<genexpr>  s%      F*+1%%Fr   c              #   F   K   | ]  }t        j                  |        y wr   r   r   s     r   r   zTimedeltaTests.<genexpr>  s     GaH&&q)Gs   !N)rZ   r[   r\   r   r   r   r   r   r   r?   rE   r   r   r   r   r   r   r   r%   r   r   r   r     s    
 +**26$($$R0K.A (

[__
5C
(

[__
5CK9J9JKKE F/:/D/DF FIG;3F3FGGGr   r   c                      e Zd Z ej                  ddd      Z ej                  ddd      Zd Zd Zd Z	d	 Z
 ej                  dd
d      Z ej                  dd
d      Z ed dD              Z ed dD              Z ed dD              Zy)	TimeTestsr   r   %      *   c                     ddl m} |S )Nr   )Time)r   r	  )r   r	  s     r   r   zTimeTests._getTargetClass  r   r   c                     ddl m} |S )Nr   )ITime)r   r  )r   r  s     r   r   zTimeTests._getTargetInterface  r   r   c                     ddl m} | j                  d      }|j                  d        |j                   |ddd             y )Nr   timeFr9   r   r   r  )r   r  r'   r>   )r   r  r.   s      r   r?   z$TimeTests.test_validate_not_required  s6    !u-ttBB'(r   c                     ddl m} ddlm} | j	                         }|j                   |ddd             | j                  ||j
                  d        y )Nr   r  rA   r   r   r  )r   r  r   rB   r'   r>   r6   )r   r  rB   r.   s       r   rE   z TimeTests.test_validate_required  s>    !:tBB'(/5>>4@r   r   r#   r   c              #   J   K   | ]  }t        j                  d d|        ywr   r   Nr   r  r   s     r   r   zTimeTests.<genexpr>  s     >!X]]2r1->r   r   c              #   J   K   | ]  }t        j                  d d|        yw)r   r   Nr  r   s     r   r   zTimeTests.<genexpr>  s     ?1x}}RA.?r   c              #   J   K   | ]  }t        j                  d d|        ywr  r  r   s     r   r   zTimeTests.<genexpr>  s     B8==R+Br   r   N)rZ   r[   r\   r   r  r   r   r   r   r?   rE   r   r   r   r   r   r   r%   r   r   r  r    s    
 &b"b1(--B+K)A (--B
"C
(--B
"C>v>?G??@IB\BCEr   r  c                        e Zd Zd Zd Zd Z 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d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z  xZ!S )ChoiceTestsc                     ddl m}  |        y Nr   )_clearzope.schema.vocabularyr  r   r  s     r   setUpzChoiceTests.setUp  
    1r   c                     ddl m}  |        y r  r  r  s     r   tearDownzChoiceTests.tearDown  r  r   c                     ddl m} |S )Nr   )Choice)r   r"  )r   r"  s     r   r   zChoiceTests._getTargetClass  s
    -r   c                     |s(d|vr$d|vr d|vrddl m} |j                  g d      |d<   t        t        |   |g|i |S )N
vocabularyvaluessourcer   SimpleVocabularyr#   r   r   )r  r(  
fromValuessuperr  _makeOneFromClass)r   clsargskwargsr(  	__class__s        r   r,  zChoiceTests._makeOneFromClass  sR     .F*F*?#3#>#>y#IF< [$9#OOOOr   c                     ddl m} |S )Nr   )IChoice)r   r2  )r   r2  s     r   r   zChoiceTests._getTargetInterface  s
    2r   c                 L    | j                  t        | j                                y r   )r6   r   r   r   s    r   (test_ctor_wo_values_vocabulary_or_sourcez4ChoiceTests.test_ctor_wo_values_vocabulary_or_source  s    *d&:&:&<=r   c                 `    | j                  t        | j                         t                      y Nr$  r6   r   r   r,   r4  s    r   test_ctor_invalid_vocabularyz(ChoiceTests.test_ctor_invalid_vocabulary  s(    *..0VX 	 	Gr   c                 `    | j                  t        | j                         t                      y )Nr&  r9  r4  s    r   test_ctor_invalid_sourcez$ChoiceTests.test_ctor_invalid_source  s"    *d&:&:&<VXNr   c                 Z    | j                  t        | j                  dt                      y )Nvoc.name)r$  r&  r6   r   r'   r,   r4  s    r   $test_ctor_both_vocabulary_and_sourcez0ChoiceTests.test_ctor_both_vocabulary_and_source  s%    MMj 	 	
r   c                 N    | j                  t        | j                  dddg       y )Nr?  r#   r   )r$  r%  r6   r   r'   r4  s    r   $test_ctor_both_vocabulary_and_valuesz0ChoiceTests.test_ctor_both_vocabulary_and_values  s'    *--J1v 	 	Or   c                 ~   ddl m} | j                  ddg      }| j                  t	        |j
                  |             | j                  t        |j
                  j                  j                               ddg       | j                  t        |j                  j                  j                               ddg       y )Nr   r'  r#   r   r%  )r  r(  r'   
assertTrue
isinstancer$  rR   sortedby_valuekeysr&  )r   r(  chooses      r   test_ctor_w_valueszChoiceTests.test_ctor_w_values  s    ;q!f-
6#4#46FGH 1 1 : : ? ? ABQFK 6 6 ; ; =>AGr   c                 8   g d}| j                  |      }| j                  t        |j                  j                  j                               t        |             | j                  t        |j                  j                  j                               t        |             | j                  t        |j                  j                  j                               t        |D cg c]#  }|j                  dd      j                  d      % c}             y c c}w )N)u   Kölnu   DüsseldorfBonnrF  asciibackslashreplace)
r'   rR   rI  r$  rJ  rK  r&  by_tokenencodedecode)r   r%  rL  r   s       r   $test_ctor_w_unicode_non_ascii_valuesz0ChoiceTests.test_ctor_w_unicode_non_ascii_values#  s    7f- 1 1 : : ? ? AB	) 6 6 ; ; =>	)6$$--2245#% HHW&89@@I % &	'%s   #(Dc                 `    | j                  d      }| j                  |j                  d       y )Nvocabr8  )r'   rR   vocabularyName)r   rL  s     r   test_ctor_w_named_vocabularyz(ChoiceTests.test_ctor_w_named_vocabulary/  s(    '2..8r   c                     t               }| j                  |      }| j                  |j                  |u        | j                  |j                  d u        y r7  )_makeSampleVocabularyr'   rG  r$  rX  )r   vrL  s      r   %test_ctor_w_preconstructed_vocabularyz1ChoiceTests.test_ctor_w_preconstructed_vocabulary3  sH    !#!,))Q./--56r   c                 z   ddl m} ddlm} t	               } |t        |             | j                  d      }|j                  d       }| j                  |j                  |       | j                  |j                  d       d|_        | j                  |j                  d       d }| j                  |||       y )Nr   r2   setVocabularyRegistryrW  r8  r#   c                     d| _         y )Nr  r4   )bounds    r   _provokezCChoiceTests.test_bind_w_preconstructed_vocabulary.<locals>._provokeE  s	    EMr   )r   r3   r  r`  r[  _makeDummyRegistryr'   bindrR   r$  rX  r5   r6   )r   r3   r`  r\  rL  rb  rc  s          r   %test_bind_w_preconstructed_vocabularyz1ChoiceTests.test_bind_w_preconstructed_vocabulary9  s    :@!#034'2D!))1---w7*	 	/8U;r   c                 "   ddl m} ddlm} ddlm}  ||       ||       G d dt
                            }| j                   |             }t               }|j                  |      }| j                  |j                  |j                         y )Nr   implementer)IBaseVocabularyISourcec                       e Zd Zd Zy)3ChoiceTests.test_bind_w_voc_not_ICSB.<locals>.Vocabc                      y r   r%   r4  s    r   __init__z<ChoiceTests.test_bind_w_voc_not_ICSB.<locals>.Vocab.__init__S  s    r   N)rZ   r[   r\   rp  r%   r   r   Vocabrn  P  s    r   rq  r8  )
zope.interfaceri  r   rj  rl  r,   r'   re  rq   r$  )r   ri  rj  rl  rq  r&  instancetargets           r   test_bind_w_voc_not_ICSBz$ChoiceTests.test_bind_w_voc_not_ICSBJ  sy    .:2	_	%	W		F 	 
 
&	 %'28X&f''):):;r   c                 @   ddl m} ddlm} ddlm}  ||       ||       G d dt
                            }| j                  d      } ||      |_        d |_        t               }|j                  |      }| j                  |j                  j                  |       y )	Nr   rh  IContextSourceBinderrk  c                       e Zd Zd Zd Zy)2ChoiceTests.test_bind_w_voc_is_ICSB.<locals>.Vocabc                     || _         y r   contextr   r}  s     r   rp  z;ChoiceTests.test_bind_w_voc_is_ICSB.<locals>.Vocab.__init__d  	    &r   c                 $    | j                  |      S r   r0  r~  s     r   __call__z;ChoiceTests.test_bind_w_voc_is_ICSB.<locals>.Vocab.__call__g      ~~g..r   NrZ   r[   r\   rp  r  r%   r   r   rq  rz  a  s    '/r   rq  tempr8  )rr  ri  r   rx  rl  r,   r'   r$  rX  re  rq   r}  )r   ri  rx  rl  rq  r&  rs  rt  s           r   test_bind_w_voc_is_ICSBz#ChoiceTests.test_bind_w_voc_is_ICSB[  s    .?2	)	*	W		/F 	/ 
 
+	/ &1!&M $8X&f''//:r   c                     ddl m} ddlm}  ||       G d dt                     }| j                  d      } ||      |_        d |_        t	               }| j                  t        |j                  |       y )Nr   rh  rw  c                       e Zd Zd Zd Zy)BChoiceTests.test_bind_w_voc_is_ICSB_but_not_ISource.<locals>.Vocabc                     || _         y r   r|  r~  s     r   rp  zKChoiceTests.test_bind_w_voc_is_ICSB_but_not_ISource.<locals>.Vocab.__init__y  r  r   c                 $    | j                  |      S r   r  r~  s     r   r  zKChoiceTests.test_bind_w_voc_is_ICSB_but_not_ISource.<locals>.Vocab.__call__|  r  r   Nr  r%   r   r   rq  r  w  s    '/r   rq  r  r8  )rr  ri  r   rx  r,   r'   r$  rX  r6   r   re  )r   ri  rx  rq  r&  rs  s         r   'test_bind_w_voc_is_ICSB_but_not_ISourcez3ChoiceTests.test_bind_w_voc_is_ICSB_but_not_ISourcer  sj    .?	)	*	/F 	/ 
+	/ &1!&M $8*fkk8<r   c                    ddl m} | j                  d      }| j                  ||j                  d       | j                  ||j                  d       | j                  |      5 }|j	                  d       d d d        j
                  }| j                  |j                  |       | j                  |j                  d       y # 1 sw Y   NxY w)Nr   ConstraintNotSatisfiedfoobarbazrF  r"   r   z1.4G)
r   r  r'   r6   rJ   rp   rq   r.   rR   rr   )r   r  r   rs   cnss        r   rM   z!ChoiceTests.test_fromUnicode_miss  s    Amm#;m<0#//3G0#//6J56 	%#OOG$	% mmcii%G,	% 	%s   $CCc                     | j                  d      }| j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       y )Nr  rF  r  r  r  rQ   r   s     r   rS   z ChoiceTests.test_fromUnicode_hit  s^    mm#;m<0&90&90&9r   c                     ddl m} | j                  ddg      }|j                  d       |j                  d       | j	                  ||j                  d       y )Nr   r  r#   r   rF  r   r   r  r'   rh   r6   r   r  choices      r   test__validate_intzChoiceTests.test__validate_int  sN    Aq!f-0&2B2BAFr   c                     ddl m} | j                  ddg      }|j                  d       |j                  d       |j                  d       | j	                  ||j                  d       y )Nr   r  acrF  dr  r  s      r   test__validate_stringz!ChoiceTests.test__validate_string  s\    AsCj10&2B2BCHr   c                     ddl m} | j                  ddg      }|j                  d       |j                  d       | j	                  ||j                  ddg       | j	                  ||j                  d       y )	Nr   r  r#   r   r   rF  r   r   r%   r  r  s      r   test__validate_tuplez ChoiceTests.test__validate_tuple  sl    Avv&67  0&2B2BQFK0&2B2BBGr   c                    ddl m} | j                  g d      }|j                  d       |j                  d       |j                  d       | j	                  ||j                  d       | j	                  ||j                  d	       y )
Nr   r  )r#   b皙?rF  r#   r  r  1r  r  r  s      r   test__validate_mixedz ChoiceTests.test__validate_mixed  sr    A&67 0&2B2BCH0&2B2BCHr   c                    ddl m} | j                  d      }| j                  |      5 }|j	                  d       d d d        j
                  }| j                  |t               | j                  |t               | j                  |j                  |       | j                  |j                  d       y # 1 sw Y   zxY w)Nr   )MissingVocabularyErrorrW  r8  r  )r   r  r'   r6   rh   rp   assertIsInstancer   LookupErrorrq   r.   rR   rr   )r   r  rL  rs   exs        r   )test__validate_w_named_vocabulary_invalidz5ChoiceTests.test__validate_w_named_vocabulary_invalid  s    ='256 	!#R 	! ]]b*-b+.bhh'2&	! 	!s   B55B>c                 h    ddl m}  G d dt              } | |              | j                          y )Nr   r_  c                       e Zd Zd Zy)MChoiceTests.test__validate_w_named_vocabulary_raises_LookupError.<locals>.Regc                     t         r   )r  r   r.  s     r   getzQChoiceTests.test__validate_w_named_vocabulary_raises_LookupError.<locals>.Reg.get  s    !!r   N)rZ   r[   r\   r  r%   r   r   Regr    s    "r   r  )r  r`  r,   r  )r   r`  r  s      r   4test__validate_w_named_vocabulary_raises_LookupErrorz@ChoiceTests.test__validate_w_named_vocabulary_raises_LookupError  s,     	A	"& 	" 	ce$668r   c                    ddl m} t               }| j                  d      } G d dt              } |       } ||       |j	                  |      }|j                  d       | j                  |j                  |df       y )Nr   r_  rW  r8  c                       e Zd ZdZd Zy)IChoiceTests.test__validate_w_named_vocabulary_passes_context.<locals>.Regr%   c                 @    | xj                   |z  c_         t               S r   )called_withr[  r  s     r   r  zMChoiceTests.test__validate_w_named_vocabulary_passes_context.<locals>.Reg.get  s      D( ,..r   N)rZ   r[   r\   r  r  r%   r   r   r  r    s    K/r   r  r#   )r  r`  r,   r'   re  rh   rR   r  )r   r`  r}  r  r  regs         r   0test__validate_w_named_vocabulary_passes_contextz<ChoiceTests.test__validate_w_named_vocabulary_passes_context  sn    @('2	/& 	/ ec"W%7G*<=r   c                     ddl m} ddlm} t	               } |t        |             | j                  d      }|j                  d       |j                  d       | j                  ||j                  d       y )	Nr   r  r_  rW  r8  r#   r   r  )	r   r  r  r`  r[  rd  r'   rh   r6   )r   r  r`  r\  rL  s        r   !test__validate_w_named_vocabularyz-ChoiceTests.test__validate_w_named_vocabulary  sc    A@!#034'20&2B2BBGr   c                     ddl m} ddlm}  ||       G d dt                     }| j                   |             }| j                  t        |j                  d       y )Nr   rh  rw  c                       e Zd Zd Zy)TChoiceTests.test__validate_source_is_ICSB_unbound.<locals>.SampleContextSourceBinderc                     t        d      )NzThis is not calledAssertionErrorr~  s     r   r  z]ChoiceTests.test__validate_source_is_ICSB_unbound.<locals>.SampleContextSourceBinder.__call__  s    $%9::r   NrZ   r[   r\   r  r%   r   r   SampleContextSourceBinderr    s    ;r   r  r<  r#   )	rr  ri  r   rx  r,   r'   r6   	TypeErrorr>   )r   ri  rx  r  r  s        r   %test__validate_source_is_ICSB_unboundz1ChoiceTests.test__validate_source_is_ICSB_unbound  sS    .?	)	*	; 	; 
+	; &?&AB)V__a8r   c                   	 ddl m} ddlm} ddlm} ddlm	  ||       G 	fddt                     } |       }| j                  |      }| j                  t        |j                  d	       t               }|j                  |      }|j                  d	       |j                  d
       | j                  ||j                  d       y )Nr   rh  r  rw  r[  c                       e Zd Z fdZy)RChoiceTests.test__validate_source_is_ICSB_bound.<locals>.SampleContextSourceBinderc                             S r   r%   )r   r}  r[  s     r   r  z[ChoiceTests.test__validate_source_is_ICSB_bound.<locals>.SampleContextSourceBinder.__call__  s    ,..r   Nr  r  s   r   r  r    s    /r   r  r<  r#   r   r  )rr  ri  r   r  rx  !zope.schema.tests.test_vocabularyr[  r,   r'   r6   r  r>   re  rh   )
r   ri  r  rx  r  sr  ocloner[  s
            @r   #test__validate_source_is_ICSB_boundz/ChoiceTests.test__validate_source_is_ICSB_bound  s    .A?K	)	*	/ 	/ 
+	/ &'a()V__a8HA0%//2Fr   )"rZ   r[   r\   r  r   r   r,  r   r5  r:  r=  rA  rD  rM  rU  rY  r]  rf  ru  r  r  rM   rS   r  r  r  r  r  r  r  r  r  r  __classcell__r  s   @r   r  r    s    P>GO
OH
'97<"<";.=(-:GIHI
'9>(H9Gr   r  c                   B    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)URITestsc                     ddl m} |S )Nr   )URI)r   r  )r   r  s     r   r   zURITests._getTargetClass  
    *
r   c                     ddl m} |S )Nr   )IURI)r   r  )r   r  s     r   r   zURITests._getTargetInterface  
    /r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   zURITests._getTargetInterfaces"  r   r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y rd   r&   r-   s     r   r/   z"URITests.test_validate_wrong_types'  r0   r   c                 l    | j                  d      }|j                  d       |j                  d        y )NFr9   http://example.com/r=   r-   s     r   r?   z#URITests.test_validate_not_required6  s+    u-,-tr   c                     ddl m} | j                         }|j                  d       | j	                  ||j                  d        y )Nr   rA   r  rC   rD   s      r   rE   zURITests.test_validate_required;  s3    :,-/5>>4@r   c                    ddl m} ddl m} | j                         }| j	                  |      5 }|j                  d       d d d        j                  }| j                  |j                  |       | j                  |j                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       y # 1 sw Y   xY w)Nr   r  
InvalidURIr"   r   r   http://example.com/
DAV:)r   r  r  r'   r6   r>   rp   rq   r.   rR   rr   )r   r  r  r.   rs   rt   s         r   test_validate_not_a_uriz URITests.test_validate_not_a_uriA  s    A5z* 	cNN2	 --gmmU++*enne<*ennjA0..*E	G	 	   C$$C-c                 f    | j                         }| j                  |j                  d      d       y Nr  rQ   r-   s     r   test_fromUnicode_okzURITests.test_fromUnicode_okQ  ,    **+AB.	0r   c                     ddl m} ddl m} | j                         }| j	                  ||j
                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       y )Nr   r  r  r"   r   r  )r   r  r  r'   r6   rJ   )r   r  r  r.   s       r   test_fromUnicode_invalidz!URITests.test_fromUnicode_invalidW  sa    A5*e&7&7=*e&7&7@0++-I	Kr   N)rZ   r[   r\   r   r   r   r/   r?   rE   r  r  r  r%   r   r   r  r    s3    F

AG 0Kr   r  c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
PythonIdentifierTestsc                     ddl m} |S )Nr   )PythonIdentifier)r   r  )r   r  s     r   r   z%PythonIdentifierTests._getTargetClassf      7r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   z*PythonIdentifierTests._getTargetInterfacesj  r   r   c                     ddl m} |S )Nr   )IPythonIdentifier)r   r  )r   r  s     r   r   z)PythonIdentifierTests._getTargetInterfaceo      <  r   c                 f    | j                         }| j                  |j                  d      d       y rf   rQ   r   pis     r   test_fromUnicode_emptyz,PythonIdentifierTests.test_fromUnicode_emptys  s&    ]]_,b1r   c                 f    | j                         }| j                  |j                  d      d       y )NnormalrQ   r  s     r   test_fromUnicode_normalz-PythonIdentifierTests.test_fromUnicode_normalw  s&    ]]_	2H=r   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y )Nz   r"   z	 normal  r  rQ   r  s     r   test_fromUnicode_strips_wsz0PythonIdentifierTests.test_fromUnicode_strips_ws{  s?    ]]_/45x@r   c                 &   ddl m} | j                         }| j                  |      5 }|j	                  d       d d d        j
                  }| j                  |j                  |       | j                  |j                  d       y # 1 sw Y   NxY w)Nr   rl   znot-an-identifier)
r   rm   r'   r6   rh   rp   rq   r.   rR   rr   )r   rm   r  rs   r  s        r   test__validate_missz)PythonIdentifierTests.test__validate_miss  st    7]]_|, 	.LL,-	. ]]bhh##67	. 	.s   BBc                 F    | j                         }|j                  d       y )Nis_an_identifierrg   r  s     r   test__validate_hitz(PythonIdentifierTests.test__validate_hit  s    ]]_
'(r   N)rZ   r[   r\   r   r   r   r  r  r  r  r  r%   r   r   r  r  b  s,     F
!2>A
8)r   r  c                   l    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y)DottedNameTestsc                     ddl m} |S )Nr   )
DottedName)r   r  )r   r  s     r   r   zDottedNameTests._getTargetClass      1r   c                     ddl m} |S )Nr   )IDottedName)r   r  )r   r  s     r   r   z#DottedNameTests._getTargetInterface      6r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   z$DottedNameTests._getTargetInterfaces  r   r   c                     | j                         }| j                  |j                  d       | j                  |j                  d        y Nr   )r'   rR   min_dotsmax_dotsr   dotteds     r   test_ctor_defaultsz"DottedNameTests.test_ctor_defaults  s5    !,$/r   c                 H    | j                  t        | j                  d       y )Nr  rC  r4  s    r   test_ctor_min_dots_invalidz*DottedNameTests.test_ctor_min_dots_invalid  s    *dmmbAr   c                 `    | j                  d      }| j                  |j                  d       y )Nr#   r  )r'   rR   r  r  s     r   test_ctor_min_dots_validz(DottedNameTests.test_ctor_min_dots_valid  &    *!,r   c                 J    | j                  t        | j                  dd       y )Nr   r#   )r  r  rC  r4  s    r   test_ctor_max_dots_invalidz*DottedNameTests.test_ctor_max_dots_invalid  s    *dmma!Lr   c                 `    | j                  d      }| j                  |j                  d       y )Nr   r  )r'   rR   r  r  s     r   test_ctor_max_dots_validz(DottedNameTests.test_ctor_max_dots_valid  r  r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y rd   r&   r-   s     r   r/   z)DottedNameTests.test_validate_wrong_types  r0   r   c                     | j                  d      }|j                  d       |j                  d       |j                  d        y )NFr9   namedotted.namer=   r-   s     r   r?   z*DottedNameTests.test_validate_not_required  s6    u-v}%tr   c                     ddl m} | j                         }|j                  d       |j                  d       | j	                  ||j                  d        y )Nr   rA   r#  r$  rC   rD   s      r   rE   z&DottedNameTests.test_validate_required  s>    :v}%/5>>4@r   c                 n   ddl m} | j                  d      }| j                  |      5 }|j	                  d       d d d        j
                  }| j                  |j                  |       | j                  |j                  d       |j	                  d       |j	                  d       y # 1 sw Y   pxY w)Nr   InvalidDottedNamer#   r  r#  r$  moar.dotted.name)
r   r(  r'   r6   r>   rp   rq   r.   rR   rr   r   r(  r.   rs   rt   s        r   test_validate_w_min_dotsz(DottedNameTests.test_validate_w_min_dots  s    <q)01 	#SNN6"	#--gmmU+/}%)*	# 	#s   B++B4c                 n   ddl m} | j                  d      }|j                  d       |j                  d       | j	                  |      5 }|j                  d       d d d        j
                  }| j                  |j                  |       | j                  |j                  d       y # 1 sw Y   NxY w)Nr   r'  r#   r  r#  r$  r)  )
r   r(  r'   r>   r6   rp   rq   r.   rR   rr   r*  s        r   test_validate_w_max_dotsz(DottedNameTests.test_validate_w_max_dots  s    <q)v}%01 	/SNN-.	/ --gmmU+(:;	/ 	/s   B++B4c                     ddl m} ddl m} | j                         }| j	                  ||j
                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       y )Nr   r  r'  r"   r   r  )r   r  r(  r'   r6   r>   )r   r  r(  r.   s       r   test_validate_not_a_dotted_namez/DottedNameTests.test_validate_not_a_dotted_name  s]    A<+U^^R@+U^^ZH0..*E	Gr   c                 n   | j                         }| j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       | j                  |j                  d      d       y )Nr$  zdotted._name_leading_underscorez_dotted.namez_dotted._namerQ   r-   s     r   test_fromUnicode_dotted_name_okz/DottedNameTests.test_fromUnicode_dotted_name_ok  s    **>:MJ 	**?;^L**+AB.	0**?;^L**+;<oNr   c                    ddl m} ddl m} | j                         }| j	                  ||j
                  d       | j	                  |      5 }|j                  d       d d d        j                  }| j                  |j                  |       | j                  |j                  d       | j	                  ||j
                  d       y # 1 sw Y   kxY w)Nr   r  r'  r"      ☃r  )r   r  r(  r'   r6   rJ   rp   rq   r.   rR   rr   )r   r  r(  r.   rs   rt   s         r   r  z(DottedNameTests.test_fromUnicode_invalid  s    A<+U->->D01 	)Si(	)--gmmU+	20++-I	K	) 	)s   CCN)rZ   r[   r\   r   r   r   r  r  r  r  r   r/   r?   rE   r+  r-  r/  r2  r  r%   r   r   r  r    sY    F
0
B-M-A
+
<G	OKr   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)IdTestsc                     ddl m} |S )Nr   )Id)r   r8  )r   r8  s     r   r   zIdTests._getTargetClass  s
    )	r   c                     ddl m} |S )Nr   )IId)r   r:  )r   r:  s     r   r   zIdTests._getTargetInterface  s
    .
r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   zIdTests._getTargetInterfaces  r   r   c                     | j                         }| j                  ||j                  ddddg i t               t	               t                      y rd   r&   r-   s     r   r/   z!IdTests.test_validate_wrong_types  r0   r   c                     | j                  d      }|j                  d       |j                  d       |j                  d        y )NFr9   r  r$  r=   r-   s     r   r?   z"IdTests.test_validate_not_required+  s7    u-,-}%tr   c                     ddl m} | j                         }|j                  d       |j                  d       | j	                  ||j                  d        y )Nr   rA   r  r$  rC   rD   s      r   rE   zIdTests.test_validate_required1  s?    :,-}%/5>>4@r   c                    ddl m} ddl m} | j                         }| j	                  |      5 }|j                  d       d d d        j                  }| j                  |j                  |       | j                  |j                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       y # 1 sw Y   xY w)Nr   r  	InvalidIdr"   r   r   r  )r   r  rA  r'   r6   r>   rp   rq   r.   rR   rr   )r   r  rA  r.   rs   rt   s         r   r  zIdTests.test_validate_not_a_uri8  s    A4y) 	SNN2	 --gmmU++)U^^U;)U^^Z@0..*E	G	 	r  c                 f    | j                         }| j                  |j                  d      d       y r  rQ   r-   s     r   test_fromUnicode_url_okzIdTests.test_fromUnicode_url_okH  r  r   c                 f    | j                         }| j                  |j                  d      d       y )Nr$  rQ   r-   s     r   r2  z'IdTests.test_fromUnicode_dotted_name_okN  s(    **>:MJr   c                 $   ddl m} ddl m} | j                         }| j	                  ||j
                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       | j	                  ||j
                  d       y )Nr   r  r@  r"   r   r4  r  )r   r  rA  r'   r6   rJ   )r   r  rA  r.   s       r   r  z IdTests.test_fromUnicode_invalidS  sy    A4)U%6%6<)U%6%6?)U%6%6	B0++-I	Kr   N)rZ   r[   r\   r   r   r   r/   r?   rE   r  rC  r2  r  r%   r   r   r6  r6    s9    F
AG 0K
	Kr   r6  c                   *    e Zd Zd Zd Zd Zd Zd Zy)InterfaceFieldTestsc                     ddl m} |S )Nr   )InterfaceField)r   rI  )r   rI  s     r   r   z#InterfaceFieldTests._getTargetClassc      5r   c                     ddl m} |S )Nr   )IInterfaceField)r   rL  )r   rL  s     r   r   z'InterfaceFieldTests._getTargetInterfaceg      :r   c                     ddl m} ddlm} | j	                         }| j                  ||dddddg i t               t               t               |j                                y )	Nr   r   )
IInterfacer"   r   r#   r$   r%   )
r   r   zope.interface.interfacesrO  r'   r(   r*   r+   r,   r   )r   r   rO  r.   s       r   r/   z-InterfaceFieldTests.test_validate_wrong_typesk  sT    !8$$EKHJJL	r   c                     ddl m}  G d d|      }| j                  d      }|j                  |       |j                  d        y )Nr   	Interfacec                       e Zd Zy)FInterfaceFieldTests.test_validate_not_required.<locals>.DummyInterfaceNrZ   r[   r\   r%   r   r   DummyInterfacerU        r   rW  Fr9   )rr  rS  r'   r>   )r   rS  rW  r.   s       r   r?   z.InterfaceFieldTests.test_validate_not_required  s;    ,	Y 	 u-~&tr   c                     ddl m} ddlm}  G d d|      }| j	                  d      }|j                  |       | j                  ||j
                  d        y )Nr   rR  rA   c                       e Zd Zy)BInterfaceFieldTests.test_validate_required.<locals>.DummyInterfaceNrV  r%   r   r   rW  r[    rX  r   rW  Tr9   )rr  rS  r   rB   r'   r>   r6   )r   rS  rB   rW  r.   s        r   rE   z*InterfaceFieldTests.test_validate_required  sH    ,:	Y 	 t,~&/5>>4@r   N)rZ   r[   r\   r   r   r/   r?   rE   r%   r   r   rG  rG  _  s    *
Ar   rG  c                   n    e Zd ZdZd Zd Z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y)CollectionTestsFc                     ddl m} |S )Nr   )
Collection)r   r_  )r   r_  s     r   r   zCollectionTests._getTargetClass  r	  r   c                     ddl m} |S )Nr   )ICollection)r   ra  )r   ra  s     r   r   z#CollectionTests._getTargetInterface  r  r   c                    ddl m} ddlm} ddlm} ddlm}  G d d|j                        } ||       G fdd	| j                               } |       }| j                  |j                         |j                  | j                  g              | j                  |      5 }|j                  | j                  t               g             d d d        j                  }	| j                  |	j                   |       | j#                  d
t%        |	j&                               | j)                  |	j&                  d   |       | j                  |	j&                  d   j*                  |       |j-                  |       G d dt                     }
|j                  | j                   |
       g             y # 1 sw Y   xY w)Nr   )	interface)Object)SchemaNotProvidedWrongContainedTypec                       e Zd ZdZy)CCollectionTests.test_schema_defined_by_subclass.<locals>.IValueTypezThe value type schemaNrZ   r[   r\   __doc__r%   r   r   
IValueTyperi    s    #r   rl  c                       e Zd ZW  Zy)>CollectionTests.test_schema_defined_by_subclass.<locals>.FieldN)rZ   r[   r\   
value_type)the_value_types   r   Fieldrn    s    'Jr   rq  r#   c                       e Zd ZdZy)BCollectionTests.test_schema_defined_by_subclass.<locals>.ValueTypezThe value typeNrj  r%   r   r   	ValueTypers    s    r   rt  )zoperc  zope.schemard  r   re  rg  rS  r   rq   ro  r>   _makeCollectionr6   r,   rp   r0  rR   lenerrorsr  schemari  )r   rc  rd  re  rg  rl  rq  r.   rs   r  rt  rp  s              @r   test_schema_defined_by_subclassz/CollectionTests.test_schema_defined_by_subclass  si   "&<=	$,, 	$  
+	(D((* 	( e&&7 	t++B/0 12 	=cNN4//
;<	= ]]bll$67C		N+biil,=>biil)):6 
		z	*	 	 
+	 	t++Y[M:;	= 	=s   &*F77G c                     | j                         }| j                  |j                  d        | j                  |j                  | j                         y r   )r'   rR   ro  unique_DEFAULT_UNIQUE)r   abscs     r   r  z"CollectionTests.test_ctor_defaults  s;    }}$/d&:&:;r   c                     ddl m}  |       }| j                  |d      }| j                  |j                  |       | j                  |j
                  d       y Nr   TextT)zope.schema._bootstrapfieldsr  r'   rR   ro  r}  )r   r  textr  s       r   test_ctor_explicitz"CollectionTests.test_ctor_explicit  sD    5v}}T4($/d+r   c                 d     G d dt               }| j                  t        | j                  |       y )Nc                       e Zd Zy)CCollectionTests.test_ctor_w_non_field_value_type.<locals>.NotAFieldNrV  r%   r   r   	NotAFieldr    rX  r   r  )r,   r6   r   r'   )r   r  s     r    test_ctor_w_non_field_value_typez0CollectionTests.test_ctor_w_non_field_value_type  s$    	 	*dmmY?r   c                    | j                         }t               }|j                  |      }| j                  |j                  |       | j                  |j
                  d        | j                  |j                  | j                         y r   )r'   r,   re  rR   r}  ro  r}  r~  )r   r  r}  rb  s       r   test_bind_wo_value_Typez'CollectionTests.test_bind_wo_value_Type  sf    }}(		'"0))40t';';<r   c                    ddl m}  |       }| j                  |d      }t               }|j	                  |      }| j                  |j                  |       | j                  t        |j                  |      d       | j                  |j                  j                  |       | j                  |j                  d       y r  )
r  r  r'   r,   re  rR   r}  rH  ro  r}  )r   r  r  r  r}  rb  s         r   test_bind_w_value_Typez&CollectionTests.test_bind_w_value_Type  s    5v}}T4((		'"0E$4$4d;TB))117;t,r   c                    ddl m} ddlm} ddlm}  |       }| j                  |      }| j                  |      5 }|j                  | j                  dg             d d d        j                  }| j                  |j                  |       | j                  |j                  | j                  dg             | j                  |j                  |       | j                  dt        |j                                | j#                  |j                   d   |       | j                  |j                   d   j$                  |j&                         y # 1 sw Y   xY w)Nr   r  rf  	WrongTyper#   )r  r  r   rg  r  r'   r6   r>   rw  rp   rq   r.   rR   rr   r0  rx  ry  r  expected_typer)   )r   r  rg  r  r  r  rs   wcts           r   #test__validate_wrong_contained_typez3CollectionTests.test__validate_wrong_contained_type  s    5=4v}}T"12 	5cMM$..s34	5 mmcii&D$8$8!$=>cmm%78C

O,cjjmY7cjjm114::>	5 	5s   "EEc                 \   ddl m} ddlm} ddlm}  |       }| j                  |d      }| j                  ||f      5 }|j                  ddg       d d d        j                  }| j                  |j                  |       | j                  |j                  ddg       y # 1 sw Y   PxY w)Nr   r  )	NotUniquer  Tr  )r  r  r   r  r  r'   r6   r>   rp   rq   r.   rR   rr   )r   r  r  r  r  r  rs   not_uniqs           r   test__validate_miss_uniquenessz.CollectionTests.test__validate_miss_uniqueness  s    544v}}T4(	956 	(#MM4,'	( ==hnnd+	'	( 	(s   B""B+c                 *   | j                  d      }|j                  | j                  d             |j                  | j                  d             | j                  || j                                | j                  || j                  d             y )Nr   
min_lengthr  r)  r#   )r'   r>   rw  assertRaisesTooShortr-   s     r   test_validate_min_lengthz(CollectionTests.test_validate_min_length  st    +t++F34t++I67!!%)=)=)?@!!%)=)=d)CDr   c                 j   | j                  d      }|j                  | j                                |j                  | j                  d             |j                  | j                  d             | j                  || j                  d             | j                  || j                  d             y )Nr   
max_lengthr  r  r   r)  )r'   r>   rw  assertRaisesTooLongr-   s     r   test_validate_max_lengthz(CollectionTests.test_validate_max_length  s    +t++-.t++D12t++F34  (<(<\(JK  (<(<Y(GHr   c                 ,   | j                  dd      }|j                  | j                  d             |j                  | j                  d             | j                  || j                                | j	                  || j                  d             y )Nr#   r   r  r  r  r  r)  )r'   r>   rw  r  r  r-   s     r   'test_validate_min_length_and_max_lengthz7CollectionTests.test_validate_min_length_and_max_length  sv    q9t++D12t++F34!!%)=)=)?@  (<(<Y(GHr   c                    | j                  d      }|j                  | j                                |j                  | j                  d             |j                  | j                  d             |j                  d        y )NFr9   r  r   )r'   r>   rw  r-   s     r   r?   z*CollectionTests.test_validate_not_required&  sa    u-t++-.t++F34t++D12tr   c                    ddl m} | j                         }|j                  | j	                                |j                  | j	                  d             |j                  | j	                  d             |j                  | j	                                |j                  | j	                  d             |j                  | j	                  d             | j                  ||j                  d        y )Nr   rA   r  r  )r   rB   r'   r>   rw  r6   rD   s      r   rE   z&CollectionTests.test_validate_required-  s    :t++-.t++F34t++D12t++-.t++F34t++D12/5>>4@r   N)rZ   r[   r\   r~  r   r   listrw  r{  r  r  r  r  r  r  r  r  r  r  r?   rE   r%   r   r   r]  r]    sa     O O#<J<
,@
=	-?"'EII	Ar   r]  c                   *    e Zd Zd Zd Zd Zd Zd Zy)SequenceTestsc                     ddl m} |S )Nr   )Sequence)r   r  )r   r  s     r   r   zSequenceTests._getTargetClass<  r   r   c                     ddl m} |S )Nr   )	ISequence)r   r  )r   r  s     r   r   z!SequenceTests._getTargetInterface@  r   r   c                     | j                         }| j                  ||j                  ddi t               t	               t                      y )Nr#   r$   r&   r-   s     r   r/   z'SequenceTests.test_validate_wrong_typesD  s=    $$KKEKH	r   c                     ddl m}  G d d|j                        } |       }| j                         }|j	                  |       y )Nr   r   c                       e Zd Zd Zd Zy)-SequenceTests.test_sequence.<locals>.Sequencec                     t        d      NzNot implementedr  )r   ry   s     r   __getitem__z9SequenceTests.test_sequence.<locals>.Sequence.__getitem__T      $%677r   c                      yr  r%   r4  s    r   __len__z5SequenceTests.test_sequence.<locals>.Sequence.__len__W      r   N)rZ   r[   r\   r  r  r%   r   r   r  r  S  s    8r   r  )r   r   r  r'   r>   )r   r   r  sequencer.   s        r   test_sequencezSequenceTests.test_sequenceP  s5    *	s|| 	 :x r   c                     ddl m}  G d d|j                        } |       }| j                         }|j	                  |       y )Nr   r  c                   .    e Zd Zd Zd Zd Zd Zd ZeZy)<SequenceTests.test_mutable_sequence.<locals>.MutableSequencec                     t        d      Nznot implementedr  )r   indexrr   s      r   insertzCSequenceTests.test_mutable_sequence.<locals>.MutableSequence.insertb  r  r   c                     t        d      r  r  r   r#  s     r   r  zHSequenceTests.test_mutable_sequence.<locals>.MutableSequence.__getitem__e  r  r   c                     t        d      S Nr%   iterr4  s    r   __iter__zESequenceTests.test_mutable_sequence.<locals>.MutableSequence.__iter__h      Bxr   c                     t        d      r  r  r   r#  rr   s      r   __setitem__zHSequenceTests.test_mutable_sequence.<locals>.MutableSequence.__setitem__k  r  r   c                      yr  r%   r4  s    r   r  zDSequenceTests.test_mutable_sequence.<locals>.MutableSequence.__len__n  r  r   N)	rZ   r[   r\   r  r  r  r  r  __delitem__r%   r   r   MutableSequencer  a  s"    88 8 &Kr   r  )r   r   r  r'   r>   )r   r   r  r  r.   s        r   test_mutable_sequencez#SequenceTests.test_mutable_sequence^  s8    *	&c11 	&$ #$x r   N)rZ   r[   r\   r   r   r/   r  r  r%   r   r   r  r  9  s    
!!r   r  c                   B     e Zd ZeZd Zd Z fdZ fdZ fdZ	 xZ
S )
TupleTestsc                     ddl m} |S )Nr   )Tuple)r   r  )r   r  s     r   r   zTupleTests._getTargetClass|  r   r   c                     ddl m} |S )Nr   )ITuple)r   r  )r   r  s     r   r   zTupleTests._getTargetInterface  r   r   c                     ddl m} | j                  |      5  t        t        |           d d d        y # 1 sw Y   y xY wNr   r  )r   r  r6   r+  r  r  r   r  r0  s     r   r  z TupleTests.test_mutable_sequence  s6    4y) 	<*d9;	< 	< 	<   5>c                     ddl m} | j                  |      5  t        t        |           d d d        y # 1 sw Y   y xY wr  )r   r  r6   r+  r  r  r  s     r   r  zTupleTests.test_sequence  s6    4y) 	4*d13	4 	4 	4r  c                     | j                         }| j                  ||j                  ddg        t        t        |           y )Nr"   r   )r'   r(   r)   r+  r  r/   r   r.   r0  s     r   r/   z$TupleTests.test_validate_wrong_types  s>    $$KK	 	j$9;r   )rZ   r[   r\   r   rw  r   r   r  r  r/   r  r  s   @r   r  r  x  s&    O<
4
< <r   r  c                   4     e Zd Zd Zd Z fdZ fdZ xZS )MutableSequenceTestsc                     ddl m} |S )Nr   )r  )r   r  )r   r  s     r   r   z$MutableSequenceTests._getTargetClass  s    6r   c                     ddl m} |S )Nr   )IMutableSequence)r   r  )r   r  s     r   r   z(MutableSequenceTests._getTargetInterface  s    ;r   c                     | j                         }| j                  ||j                  ddd       t        t        |           y )Nr"   r   r%   )r'   r(   r)   r+  r  r/   r  s     r   r/   z.MutableSequenceTests.test_validate_wrong_types  s?    $$KK	 	"DCEr   c                     ddl m} | j                  |      5  t        t        |           d d d        y # 1 sw Y   y xY wr  )r   r  r6   r+  r  r  r  s     r   r  z"MutableSequenceTests.test_sequence  s7    4y) 	>&;=	> 	> 	>r  )rZ   r[   r\   r   r   r/   r  r  r  s   @r   r  r    s     F> >r   r  c                   *     e Zd Zd Zd Z fdZ xZS )	ListTestsc                     ddl m} |S )Nr   )List)r   r  )r   r  s     r   r   zListTests._getTargetClass  r   r   c                     ddl m} |S )Nr   )IList)r   r  )r   r  s     r   r   zListTests._getTargetInterface  r   r   c                     ddl m} | j                  |      5  t        t        |           d d d        y # 1 sw Y   y xY wr  )r   r  r6   r+  r  r  r  s     r   r  zListTests.test_mutable_sequence  s6    4y) 	;)T8:	; 	; 	;r  )rZ   r[   r\   r   r   r  r  r  s   @r   r  r    s    ; ;r   r  c                   0    e Zd ZdZeZeZd Zd Z	d Z
d Zy)SetTestsTc                     ddl m} |S )Nr   )Set)r   r  )r   r  s     r   r   zSetTests._getTargetClass  r  r   c                     ddl m} |S )Nr   )ISet)r   r  )r   r  s     r   r   zSetTests._getTargetInterface  r  r   c                     | j                  t        | j                  d       | j                  d       | j                  | j                         j                         y )NF)r}  T)r6   r  r'   rG  r}  r4  s    r   test_ctor_disallows_uniquez#SetTests.test_ctor_disallows_unique  sA    )T]]5AT"../r   c                     | j                         }| j                  ||j                  dddddg i | j                         t	                      y Nr"   r   r#   r$   r%   )r'   r(   r)   _makeWrongSetr,   r-   s     r   r/   z"SetTests.test_validate_wrong_types  sK    $$KK H	r   N)rZ   r[   r\   r~  r*   rw  r+   r  r   r   r  r/   r%   r   r   r  r    s'     OOM0
r   r  c                        e Zd ZeZeZd Zd Zy)FrozenSetTestsc                     ddl m} |S )Nr   )	FrozenSet)r   r  )r   r  s     r   r   zFrozenSetTests._getTargetClass  r   r   c                     ddl m} |S )Nr   )
IFrozenSet)r   r  )r   r  s     r   r   z"FrozenSetTests._getTargetInterface  r   r   N)	rZ   r[   r\   r+   rw  r*   r  r   r   r%   r   r   r  r    s    OMr   r  c                   l    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y)MappingTestsc                     ddl m} |S )Nr   )Mapping)r   r  )r   r  s     r   r   zMappingTests._getTargetClass  s
    .r   c                     ddl m} |S )Nr   )IMapping)r   r  )r   r  s     r   r   z MappingTests._getTargetInterface  s
    3r   c                 X    | j                  t        | j                  t                      y )Nkey_typer@  r4  s    r   test_ctor_key_type_not_IFieldz*MappingTests.test_ctor_key_type_not_IField  s    *dmmfhGr   c                 X    | j                  t        | j                  t                      y )Nro  r@  r4  s    r   test_ctor_value_type_not_IFieldz,MappingTests.test_ctor_value_type_not_IField  s    *dmmIr   c                     | j                         }| j                  ||j                  dddddg t               t	               t                      y r  r&   r-   s     r   r/   z&MappingTests.test_validate_wrong_types  sF    $$KKEKH	r   c                     | j                  d      }|j                  i        |j                  ddd       |j                  ddi       |j                  d        y )NFr9   r  r  r  r   r  r=   r-   s     r   r?   z'MappingTests.test_validate_not_required  sK    u-r33'(3x tr   c                     ddl m} | j                         }|j                  i        |j                  ddd       |j                  ddi       | j	                  ||j                  d        y )Nr   rA   r  r  r  r   r  rC   rD   s      r   rE   z#MappingTests.test_validate_required  sS    :r33'(3x /5>>4@r   c                    ddl m} ddlm} ddlm} | j                   |             }|j                  i        |j                  ddd       |j                  d	d
i       | j                  |      5 }|j                  d
di       d d d        j                  }| j                  |j                  |       | j                  |j                  d
di       | j                  |j                  |       | j                  dt        |j                               | j!                  |j                  d   |       | j                  |j"                  j$                  |j                  d   j&                         y # 1 sw Y   xY w)Nr   Intrf  r  r	  r  r  r  r   r  r#   )r  r  r   rg  r  r'   r>   r6   rp   rq   r.   rR   rr   r0  rx  ry  r  r
  r)   r  r   r  rg  r  r.   rs   r  s          r   test_validate_invalid_key_typez+MappingTests.test_validate_invalid_key_type&  s   4=4su-r33'(3x 12 	%cNNC8$	% mmcii'S!H-cmm%78C

O,cjjmY7enn**CJJqM,G,GH	% 	%   3E33E<c                    ddl m} ddlm} ddlm} | j                   |             }|j                  i        |j                  ddd       |j                  d	d
i       | j                  |      5 }|j                  dd	i       d d d        j                  }| j                  |j                  |       | j                  |j                  dd	i       | j                  |j                  |       | j                  dt        |j                               | j!                  |j                  d   |       | j                  |j"                  j$                  |j                  d   j&                         y # 1 sw Y   xY w)Nr   r  rf  r  r  r#   r   )r  r  r  r   )r  r  r   rg  r  r'   r>   r6   rp   rq   r.   rR   rr   r0  rx  ry  r  ro  r)   r  r  s          r    test_validate_invalid_value_typez-MappingTests.test_validate_invalid_value_type9  s    4=4/rQQ'(Qx 12 	%cNNAs8$	% mmcii'QH-cmm%78C

O,cjjmY7e&&,,cjjm.I.IJ	% 	%r  c                     | j                  d      }|j                  ddi       |j                  ddd       | j                  |i        y )Nr#   r  r  r  r  )r'   r>   r  r-   s     r   r  z%MappingTests.test_validate_min_lengthL  sC    +3x 33'(!!%,r   c                     | j                  d      }|j                  i        |j                  ddi       | j                  |ddd       | j                  |dddd       y )Nr#   r  r  r  r  r  r)  )r'   r>   r  r-   s     r   r  z%MappingTests.test_validate_max_lengthR  sZ    +r3x   CC(89  CCC(@Ar   c                     | j                  dd      }|j                  ddi       |j                  ddd       | j                  |i        | j                  |dddd       y )	Nr#   r   r  r  r  r  r  r)  )r'   r>   r  r  r-   s     r   r  z4MappingTests.test_validate_min_length_and_max_lengthY  s\    q93x 33'(!!%,  CCC(@Ar   c                     | j                         }t               }|j                  |      }| j                  |j                         | j                  |j
                         y r   )r'   r,   re  assertIsNoner
  ro  )r   r.   r}  field2s       r   %test_bind_without_key_and_value_typesz2MappingTests.test_bind_without_key_and_value_types`  sH    (G$&//*&++,r   c                    ddl m} | j                   |        |             }t               }|j	                  |      }| j                  |j                  j                  |       | j                  |j                  j                  |       y )Nr   r  )r
  ro  )	rv  r  r'   r,   re  rR   r
  r}  ro  )r   r  r.   r}  r  s        r   #test_bind_binds_key_and_value_typesz0MappingTests.test_bind_binds_key_and_value_typesg  sf    #su?(G$00':**22G<r   c                     ddl m}  G d d|j                        } |       }| j                         }|j	                  |       y )Nr   r  c                       e Zd Zd Zd Zd Zy)*MappingTests.test_mapping.<locals>.Mappingc                     t        d      r  r  r  s     r   r  z6MappingTests.test_mapping.<locals>.Mapping.__getitem__t  r  r   c                     t        d      S r  r  r4  s    r   r  z3MappingTests.test_mapping.<locals>.Mapping.__iter__w  r  r   c                      yr  r%   r4  s    r   r  z2MappingTests.test_mapping.<locals>.Mapping.__len__z  r  r   N)rZ   r[   r\   r  r  r  r%   r   r   r  r%  r  s    8 r   r  )r   r   r  r'   r>   )r   r   r  mmr.   s        r   test_mappingzMappingTests.test_mappingo  s5    *		ckk 		 Yrr   c                     ddl m}  G d d|j                        } |       }| j                         }|j	                  |       y )Nr   r  c                   (    e Zd Zd Zd Zd Zd ZeZy)9MappingTests.test_mutable_mapping.<locals>.MutableMappingc                     t        d      r  r  r  s     r   r  zEMappingTests.test_mutable_mapping.<locals>.MutableMapping.__getitem__  r  r   c                     t        d      S r  r  r4  s    r   r  zBMappingTests.test_mutable_mapping.<locals>.MutableMapping.__iter__  r  r   c                     t        d      r  r  r  s      r   r  zEMappingTests.test_mutable_mapping.<locals>.MutableMapping.__setitem__  r  r   c                      yr  r%   r4  s    r   r  zAMappingTests.test_mutable_mapping.<locals>.MutableMapping.__len__  r  r   N)rZ   r[   r\   r  r  r  r  r  r%   r   r   MutableMappingr-    s    8 8 &Kr   r2  )r   r   r2  r'   r>   )r   r   r2  r)  r.   s        r   test_mutable_mappingz!MappingTests.test_mutable_mapping  s8    *	&S// 	&  rr   N)rZ   r[   r\   r   r   r  r  r/   r?   rE   r  r  r  r  r  r   r"  r*  r3  r%   r   r   r  r    sY    
HJAI&K&-BB-=$r   r  c                   *     e Zd Zd Zd Z fdZ xZS )MutableMappingTestsc                     ddl m} |S )Nr   )r2  )r   r2  )r   r2  s     r   r   z#MutableMappingTests._getTargetClass  rJ  r   c                     ddl m} |S )Nr   )IMutableMapping)r   r8  )r   r8  s     r   r   z'MutableMappingTests._getTargetInterface  rM  r   c                     ddl m} | j                  |      5  t        t        |           d d d        y # 1 sw Y   y xY wr  )r   r  r6   r+  r5  r*  r  s     r   r*  z MutableMappingTests.test_mapping  s7    4y) 	<%t9;	< 	< 	<r  )rZ   r[   r\   r   r   r*  r  r  s   @r   r5  r5    s    < <r   r5  c                   *     e Zd Zd Zd Z fdZ xZS )	DictTestsc                     ddl m} |S )Nr   )Dict)r   r=  )r   r=  s     r   r   zDictTests._getTargetClass  r   r   c                     ddl m} |S )Nr   )IDict)r   r?  )r   r?  s     r   r   zDictTests._getTargetInterface  r   r   c                     ddl m} | j                  |      5  t        t        |           d d d        y # 1 sw Y   y xY wr  )r   r  r6   r+  r;  r3  r  s     r   r3  zDictTests.test_mutable_mapping  s6    4y) 	:)T79	: 	: 	:r  )rZ   r[   r\   r   r   r3  r  r  s   @r   r;  r;    s    : :r   r;  c                   *    e Zd Zd Zd Zd Zd Zd Zy)NativeStringTestsc                     ddl m} |S )Nr   )NativeString)r   rD  )r   rD  s     r   r   z!NativeStringTests._getTargetClass  s    3r   c                     ddl m} |S )Nr   )INativeString)r   rF  )r   rF  s     r   r   z%NativeStringTests._getTargetInterface  s    8r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   z&NativeStringTests._getTargetInterfaces  r   r   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y Nr   r"   rP   rO   rV   r-   s     r   rX   z NativeStringTests.test_fromBytes  ?    -r25zBr   c                     | j                         }| j                  |j                  d      t               | j	                  |j                  d      d       | j	                  |j                  d      d       y Nr"   rO   r'   r  rJ   strrR   r-   s     r   test_fromUnicodez"NativeStringTests.test_fromUnicode  ^    e//4c:**3/4**;7Dr   NrZ   r[   r\   r   r   r   rX   rO  r%   r   r   rB  rB    s    F
C
Er   rB  c                   *    e Zd Zd Zd Zd Zd Zd Zy)NativeStringLineTestsc                     ddl m} |S )Nr   )NativeStringLine)r   rU  )r   rU  s     r   r   z%NativeStringLineTests._getTargetClass  r  r   c                     ddl m} |S )Nr   )INativeStringLine)r   rW  )r   rW  s     r   r   z)NativeStringLineTests._getTargetInterface  r  r   c                 @    ddl m} ddl m} | j                         ||gS r   r   r   s      r   r   z*NativeStringLineTests._getTargetInterfaces  r   r   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y rI  rV   r-   s     r   rX   z$NativeStringLineTests.test_fromBytes  rJ  r   c                     | j                         }| j                  |j                  d      t               | j	                  |j                  d      d       | j	                  |j                  d      d       y rL  rM  r-   s     r   rO  z&NativeStringLineTests.test_fromUnicode  rP  r   NrQ  r%   r   r   rS  rS    s     !F
C
Er   rS  c                       e Zd Zd Zd Zd Zy)StrippedNativeStringLineTestsc                     ddl m} |S )Nr   )_StrippedNativeStringLine)r   r^  )r   r^  s     r   r   z-StrippedNativeStringLineTests._getTargetClass  s    @((r   c                     | j                         }| j                  |j                  d      d       | j                  |j                  d      d       y )N    r"    )r'   rR   rW   rJ   r-   s     r   test_stripsz)StrippedNativeStringLineTests.test_strips  sA    .3**40"5r   c                 &    | j                  d       y )Nz?Not applicable; we inherit implementation but have no interface)skipTestr4  s    r   test_iface_is_first_in_sroz8StrippedNativeStringLineTests.test_iface_is_first_in_sro  s     " 	#r   N)rZ   r[   r\   r   rb  re  r%   r   r   r\  r\    s    )6
#r   r\  c                  \    ddl m}  ddlm}  | |       G d dt                     } |       S )Nr   rh  )IVocabularyc                   $    e Zd Zd Zd Zd Zd Zy)/_makeSampleVocabulary.<locals>.SampleVocabularyc                     t        d      r  r  r4  s    r   r  z8_makeSampleVocabulary.<locals>.SampleVocabulary.__iter__       !233r   c                 "    d|cxk  xr dk  S c S )Nr   r   r%   r   rr   s     r   __contains__z<_makeSampleVocabulary.<locals>.SampleVocabulary.__contains__  s    ??"?"r   c                      y)Nr   r%   r4  s    r   r  z7_makeSampleVocabulary.<locals>.SampleVocabulary.__len__  s    r   c                     t        d      r  r  rm  s     r   getTermz7_makeSampleVocabulary.<locals>.SampleVocabulary.getTerm  rk  r   N)rZ   r[   r\   r  rn  r  rq  r%   r   r   SampleVocabularyri    s    	4	#		4r   rr  )rr  ri  r   rg  r,   )ri  rg  rr  s      r   r[  r[    s1    *246 4 4 r   c                 :    ddl m  G fdd      } ||       S )Nr   VocabularyRegistryc                       e Zd Z fdZd Zy))_makeDummyRegistry.<locals>.DummyRegistryc                 6    j                  |        || _        y r   )rp  _vocabulary)r   r$  ru  s     r   rp  z2_makeDummyRegistry.<locals>.DummyRegistry.__init__  s    ''-)Dr   c                     | j                   S r   )ry  )r   r}  r#  s      r   r  z-_makeDummyRegistry.<locals>.DummyRegistry.get"  s    ###r   N)rZ   r[   r\   rp  r  rt  s   r   DummyRegistryrw    s    	*	$r   r{  )r  ru  )r\  r{  ru  s     @r   rd  rd    s     9$* $ r   c                      dd l } t        j                  j                  t              }|j                  t        j                  | j                  j                  t        j                               |S )Nr   )optionflags)r   unittestdefaultTestLoaderloadTestsFromNamerZ   addTestsdoctestDocTestSuiterz  _fieldELLIPSIS)ru  suites     r   
test_suiter  '  sQ    &&88BE	NN7''$$  Lr   )*r   r  r~  'zope.schema.tests.test__bootstrapfieldsr   r   r   r   r   r   TestCaser
   r^   r|   r   r   r   r   r   r  r  r  r  r  r6  rG  r]  r  r  r  r  r  r  r  r5  r;  rB  rS  r\  r[  rd  r  r%   r   r   <module>r     s      F A ? N G GBD#$""BDJ,"#$"","^;D'(&&;D|3>'(&&3>l.@ .@b0J.'&'%%	0Jf1F*#"#!!	1Fh#H/('&&#HL"D*#"!!"DJgG$##gGT	IK!"  IKX*)./$--*)ZyK()''yKxQK !QKh5A,-"++5Ap_A(#''_AD<!'#<!~< <B>= >4;$ ; !"!HX a%& $$aH<, < :# : E*+ ))E:E./$--E:#$9 # .
r   