
    f                     :    d Z ddlZ G d dej                        Zy)zTests of the states example.
    Nc                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)StateSelectionTestc                 h    ddl m} ddlm} ddlm}  |         |       }|j                  d|       y )Nr   StateVocabulary_clear)getVocabularyRegistrystates)zope.schema.tests.statesr   zope.schema.vocabularyr	   r
   register)selfr   r	   r
   vrs        u/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/zope/schema/tests/test_states.pysetUpzStateSelectionTest.setUp   s&    <1@"$
Ho.    c                     ddl m}  |        y )Nr   r   )r   r	   )r   r	   s     r   tearDownzStateSelectionTest.tearDown   s
    1r   c                 J    ddl m} ddlm ddlm  G fdd|      }|S )Nr   )	Interface)Choicer   c                   ~    e Zd Z W  dddd      Z W  dddd      Z W  dd W              Z W  d	d
d      Zy)2StateSelectionTest._makeSchema.<locals>.IBirthInfozState of Birthz!The state in which you were born.r   AL)titledescription
vocabularydefaultzFavorite StatezThe state you like the most.)r   r   r   NamezThe name of your new stateN)__name__
__module____qualname__state1state2state3state4)r   r   s   r   
IBirthInfor   (   s^    '@#	F '@#	F ';*,F
 9#Fr   r(   )zope.interfacer   zope.schemar   r   r   )r   r   r(   r   r   s      @@r   _makeSchemazStateSelectionTest._makeSchema!   s     ,&<	 	. r   c                 >   ddl m} ddlm} | j	                         }|j                  d      }|j                  t                     }| j                   |||j                               | j                  |j                  j                  d      j                  d       y )Nr   verifyObjectIVocabularyr$   VAVirginia)zope.interface.verifyr.   zope.schema.interfacesr0   r+   getDescriptionForbindobject
assertTruer   assertEqualgetTermr   r   r.   r0   schemafieldbounds         r   test_default_presentationz,StateSelectionTest.test_default_presentationA   sv    66!!#((2

68$[%2B2BCD))11$7==zJr   c                    ddl m} ddlm} ddlm}  |       }| j                   |||             d}t        |      }|D ]$  }|dz  }| j                  |j                  |v        & | j                  |t        |             |D cg c]  }|j                   }}|j                          |D cg c]  }|j                   }}|j                          | j                  ||       y c c}w c c}w )Nr   r-   r/   r      )r3   r.   r4   r0   r   r   r8   listvaluer9   lensort)	r   r.   r0   r   vocabcountLtermL2s	            r   test_containsz StateSelectionTest.test_containsK   s    66<![%89K 	1DQJEOODJJ%/0	1 	E
+$%&DTZZ&&	%*+Tdjj++
	B	 '+s   C(0C-c                 8   ddl m} ddlm} | j	                         }|j                  d      }|j                  d       }| j                  |j                  d u        | j                   |||j                               | j                  d|j                  v        y )Nr   r-   r/   r&   r   )
r3   r.   r4   r0   r+   r5   r6   r8   vocabularyNamer   r;   s         r   test_prebound_vocabularyz+StateSelectionTest.test_prebound_vocabulary_   s{    66!!#((2

4 ,,45[%2B2BCD 0 001r   N)	r!   r"   r#   r   r   r+   r?   rK   rN    r   r   r   r      s"    /@K (	2r   r   )__doc__unittestTestCaser   rO   r   r   <module>rS      s!    U2** U2r   