Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_string.cpython-34.pyo

�
f f��@sgddlZddlZddlmZGdd�dej�Zdd�Zedkrce�ndS)�N)�supportc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�
ModuleTestcCsCtjtjtjtjtjtjtjtjtj	dS)N)
�stringZ
whitespaceZascii_lowercaseZascii_uppercase�
ascii_lettersZdigitsZ	hexdigitsZ	octdigitsZpunctuationZ	printable)�self�r�5/opt/alt/python34/lib64/python3.4/test/test_string.py�
test_attrsszModuleTest.test_attrscCs�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjdd�d�|jtjd	�d
�|jtjd�d�|jtjd
�d�|jtjd
d�d�dS)Nzabc def ghizAbc Def Ghizabc	def
ghizabc	   def  
ghizABC DEF GHIzABC-DEF-GHI�-zAbc-Def-GhizABC-def DEF-ghi GHIzAbc-def Def-ghi Ghiz   aBc  DeF   zAbc Defz		aBc	DeF	�	z		Abc	Def	)�assertEqualrZcapwords)rrrr�
test_capwordsszModuleTest.test_capwordscCs�tj�}|j|jd�d�|j|jdd�d�|j|jddd�d�|jt|j�|jttjj�dS)N�foozfoo{0}�barZfoobarz
foo{1}{0}-{1}�z	foo6bar-6)r�	Formatterr�format�assertRaises�	TypeError)r�fmtrrr�test_basic_formatterszModuleTest.test_basic_formattercCs�tj�}|j|jddd�d�|jt|jd�|j|jddd�d�|jt|jd�|j|jddd�d�|jt|jd�|j|jdddd�d�dS)	Nz-{arg}-�arg�testz-test-z-{self}-rz-{format_string}-�
format_string)rrrrr�KeyError)rrrrr�test_format_keyword_arguments%sz(ModuleTest.test_format_keyword_argumentscCsWtj�}|j|jddd�djdd��|j|jddddd�djdddd��|j|jddd�djdd��|j|jdddd�djddd��|j|jd	d
ddd�d	jd
ddd��|jt��|jddd�WdQX|jt��|jd
dd�WdQXdS)Nzfoo{}{}rrzfoo{1}{num}{1}Znumz{:^{}}z	{:^{}} {}�Xz{:^{pad}}{}rZpadzfoo{1}{}zfoo{}{1})rrrrr�
ValueError)rrrrr�test_auto_numbering1szModuleTest.test_auto_numberingcCs�tj�}|j|jddd�d�|j|jdd�d�|jt|jdd�|j|jdd�d	�|j|jdtj�d
�|j|jdtd��d�|j|jdtd
��d�dS)Nz	-{arg!r}-rrz-'test'-z{0!s}z{0!h}z{0!a}�*Z42z6'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'�z'\xff'�z'\u0100')rrrrrrr�chr)rrrrr�test_conversion_specifiersDs"z%ModuleTest.test_conversion_specifiersc
Csntj�}Gdd�d�}|�}|j|jd|�d�|jt��|jdd�WdQXdS)Nc@seZdZdd�ZdS)z,ModuleTest.test_name_lookup.<locals>.AnyAttrcSs|S)Nr)r�attrrrr�__getattr__Ssz8ModuleTest.test_name_lookup.<locals>.AnyAttr.__getattr__N)�__name__�
__module__�__qualname__r%rrrr�AnyAttrRsr)z{0.lumber}{0.jack}Z
lumberjack�)rrrrr�AttributeError)rrr)�xrrr�test_name_lookupPs	zModuleTest.test_name_lookupcCs�tj�}dddg}|j|jd|�d�|jt��|jdg�WdQX|jt��|jdi�WdQXdS)NZeggs�andZspamz{0[2]}{0[0]}Zspameggs)rrrrr�
IndexErrorr)rr�lookuprrr�test_index_lookupZszModuleTest.test_index_lookupcCsIGdd�dtj�}|idd6�}|j|jd�d�dS)Nc@s+eZdZidd�Zdd�ZdS)z>ModuleTest.test_override_get_value.<locals>.NamespaceFormattercSstjj|�||_dS)N)rr�__init__�	namespace)rr3rrrr2eszGModuleTest.test_override_get_value.<locals>.NamespaceFormatter.__init__cSsXt|t�r>y||SWqTtk
r:|j|SYqTXntjj|||�dS)N)�
isinstance�strrr3rr�	get_value)r�key�args�kwdsrrrr6is
zHModuleTest.test_override_get_value.<locals>.NamespaceFormatter.get_valueN)r&r'r(r2r6rrrr�NamespaceFormatterdsr:ZhelloZgreetingz{greeting}, world!z
hello, world!)rrrr)rr:rrrr�test_override_get_valuecsz"ModuleTest.test_override_get_valuecCsHGdd�dtj�}|�}|j|jddd��d�dS)Nc@seZdZdd�ZdS)z<ModuleTest.test_override_format_field.<locals>.CallFormattercSst|�|�S)N)r)r�value�format_specrrr�format_fieldyszIModuleTest.test_override_format_field.<locals>.CallFormatter.format_fieldN)r&r'r(r>rrrr�
CallFormatterxsr?z*{0}*cSsdS)N�resultrrrrr�<lambda>}sz7ModuleTest.test_override_format_field.<locals>.<lambda>z*result*)rrrr)rr?rrrr�test_override_format_fieldws	z%ModuleTest.test_override_format_fieldcCsEGdd�dtj�}|�}|j|jddd�d�dS)Ncs"eZdZ�fdd�Z�S)z:ModuleTest.test_override_convert_field.<locals>.XFormattercs#|dkrdSt�j||�S)Nr,)�super�
convert_field)rr<Z
conversion)�	__class__rrrD�szHModuleTest.test_override_convert_field.<locals>.XFormatter.convert_field)r&r'r(rDrr)rEr�
XFormatter�srFz{0!r}:{0!x}rz
'foo':None)rrrr)rrFrrrr�test_override_convert_field�s	z&ModuleTest.test_override_convert_fieldcCsBGdd�dtj�}|�}|j|jdd�d�dS)Nc@seZdZdd�ZdS)z4ModuleTest.test_override_parse.<locals>.BarFormattercssuxn|jd�D]]}|ddkr\|dd�jd�\}}}d||dfVq|dddfVqWdS)N�|r�+��:r*)�split�	partition)rrZfieldZ
field_name�_r=rrr�parse�s
"z:ModuleTest.test_override_parse.<locals>.BarFormatter.parseN)r&r'r(rOrrrr�BarFormatter�srPz*|+0:^10s|*rz*   foo    *)rrrr)rrPrrrr�test_override_parse�s	zModuleTest.test_override_parsec
CsGdd�dtj�}|�}|j|jdd�d�|j|jdddd�d	�|j|jd
dddd�d�|jt|jd
ddddd
d�|jt|jddd�|jt|jddddd�|jt|jddddd�dS)Nc@seZdZdd�ZdS)z@ModuleTest.test_check_unused_args.<locals>.CheckAllUsedFormattercSset|j��}|jtdt|���x|D]}|j|�q5W|ratd��ndS)Nrzunused arguments)�set�keys�update�range�len�remover)rZ	used_argsr8�kwargsZunused_argsrrrr�check_unused_args�s
zRModuleTest.test_check_unused_args.<locals>.CheckAllUsedFormatter.check_unused_argsN)r&r'r(rYrrrr�CheckAllUsedFormatter�srZz{0}�
Z10z{0}{i}�i�dZ10100z	{0}{i}{1}�Z1010020�jrz{i})rrrrrr)rrZrrrr�test_check_unused_args�s	"%("z!ModuleTest.test_check_unused_argsc
Csrtj�}f}tdd�}|jt��#}|jd||t�d�WdQX|jdt|j	��dS)Nr\r]z{i}rJZ	recursion���)
rr�dictrrZ_vformatrRZassertInr5Z	exception)rrr8rX�errrrr�test_vformat_recursion_limit�s"z'ModuleTest.test_vformat_recursion_limitN)r&r'r(r	r
rrrr#r-r1r;rBrGrQr`rdrrrrrs
		rcCstjt�dS)N)rZrun_unittestrrrrr�	test_main�sre�__main__)ZunittestrrrZTestCaserrer&rrrr�<module>s
�