a zeh@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z ddlmZddZeeddZGd d d eZGd d d e je je je jZGd dde jZGddde jZedkre dS)z Test script for the Unicode implementation. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. N)support string_tests)assert_python_failurecCsXd dd}d dd}ddd}ddd }|d kr<||ddfS|d krP||ddfSdSdS)NstrictcSsdSN*inputerrorsrrE/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_unicode.pydecode1sz search_function..decode1cSsdSrrr rrr encode1sz search_function..encode1cSsdSN)rrrr rrr encode2sz search_function..encode2cSsdSrrr rrr decode2sz search_function..decode2 test.unicode1 test.unicode2)r)r)r)rr)encodingr rrrrrr search_functions      rcCs |S)z Try to get a fresh clone of the specified text: new object with a reference count of 1. This is a best-effort: latin1 single letters and the empty string ('') are singletons and cannot be cloned. )encodedecode)textrrr duplicate_string'src@s eZdZdS) StrSubclassN)__name__ __module__ __qualname__rrrr r1srcseZdZeZddZddZddZddZd d Z d d Z d dZ ddZ ddZ ddZddZddZddZddZddZdd Zeejd!kd"d#d$Zd%d&Zejd'd(Zd)d*Zd+d,Zfd-d.Z fd/d0Z!fd1d2Z"fd3d4Z#e$d5d6d7Z%fd8d9Z&fd:d;Z'fdd?Z)fd@dAZ*dBdCZ+dDdEZ,ejdFdGZ-dHdIZ.dJdKZ/dLdMZ0dNdOZ1dPdQZ2dRdSZ3fdTdUZ4dVdWZ5dXdYZ6e7ejdZkd[ejd\d]Z8d^d_Z9d`daZ:dbdcZ;dddeZdjdkZ?dldmZ@dndoZAdpdqZBdrdsZCdtduZDejdvdwZEdxdyZFdzd{ZGeHd|d}d~ddZIddZJddZKddZLddZMddZNddZOddZPddZQddZRddZSddZTddZUddZVddZWddZXddZYddZZddZ[ddZ\ddZ]ddZ^ddZ_ddZ`ddZaeejd!kp@ebcddkdddZdejddZeddZfddZgddZhddZiejddZjddÄZkddńZlddDŽZmZnS) UnicodeTestcGst||}||}||||t|t|u||urGdddt}||}t||}||}||||||udS)Nc@seZdZddZdS)z)UnicodeTest.checkequalnofix..usubcSsdt|S)Nzusub(%r))str__repr__selfrrr r Esz2UnicodeTest.checkequalnofix..usub.__repr__Nrrrr rrrr usubDsr$)getattr assertEqual assertTruetyper)r"resultobjectZ methodnameargsmethodZ realresultr$rrr checkequalnofix;s    zUnicodeTest.checkequalnofixcCsV|dd|dd|ttd|ttd|ttdd|dddS) Nÿ￿z '\Ufffffffe'z '\Uffffffff'z'\U%08x'z\u0020 )r& assertRaises SyntaxErrorevalassertNotEqualr!rrr test_literalsMs   zUnicodeTest.test_literalscCs<tjds8|tdd|tdd|tdd|tdd |td d |td d |tdd|tdd|tdd|tdd|tdd|tdd|tddd}tdtttd}||||tdtdGddd}| t t|dS) Njavaabc'abc'ab\c'ab\\c'ab\'ab\\'\c'\\c'\'\\' '\n' '\r' '\t''\x08''"'\'"''"'""'"'a'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'0𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿c@seZdZddZdS)z)UnicodeTest.test_ascii..WrongReprcSsdSNs byte-reprrr!rrr r |sz2UnicodeTest.test_ascii..WrongRepr.__repr__Nr#rrrr WrongRepr{srT) sysplatform startswithr&asciijoinmapchrranger2 TypeErrorr"Z latin1reprZtestreprrTrrr test_asciiVs.  zUnicodeTest.test_asciicCs<tjds8|tdd|tdd|tdd|tdd |td d |td d |tdd|tdd|tdd|tdd|tdd|tdd|tddd}tdtttd}||||tdtdGddd}| t t|dS) Nr7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOu%'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'rPrQrRc@seZdZddZdS)z(UnicodeTest.test_repr..WrongReprcSsdSrSrr!rrr r sz1UnicodeTest.test_repr..WrongRepr.__repr__Nr#rrrr rTsrT) rUrVrWr&reprrYrZr[r\r2r]r^rrr test_reprs.  zUnicodeTest.test_reprcCsJd}|t|d|t|d|t|d|tt|dS)Nu ᄑ∢㌳uᄑu∢u㌳)__iter__r&nextr2 StopIteration)r"itrrr test_iteratorss zUnicodeTest.test_iteratorscCsltj||dddd|dddd|dddd|dddd|dddd|ddddd|ddddd |d ddddd|dddddd |d d dd|d d dd|d ddd|dddd|dddd|dddd|d ddd|d ddd|d ddd|dddd|dddd|dddddS)NZaaacountarbi u Ăaaaaaaaaaau􀌄aaaaaaaaaau􀌄ĂĂĂĂĂĂĂĂĂĂĂZ aaaaaaaaaa􀌄uĂĂĂĂĂĂĂĂĂĂuĂa_a_a_a_a_a_a_a_a_a_a_u􀌄a_a_a_a_a_a_a_a_a_a_u"􀌄Ă_Ă_Ă_Ă_Ă_Ă_Ă_Ă_Ă_Ă_Ă_aĂa􀌄Ă􀌄)r CommonTest test_countr- checkequalr!rrr rws, zUnicodeTest.test_countcCstj||dddd|dddd|dddd|dddd|dd dd |dd dd |dd dd |d ddd|ddddd|ddddd|tdj|tdjd|dddd|dddd|dddd|dddd|dddd |dddd |dddd|dddd|dddd |dddd!|dddd"|dddd#dS)$NdufaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaĂfindrorlȁĠȠuhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa􀌄rp􀈄􂀄r abcdefghiabcr8 rkdefhellorĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂari􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄a􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄ĂdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂa_rq􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄a_􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄Ă_rrrsrtru)rrv test_findrxr-r2r]rzr!rrr rs2 zUnicodeTest.test_findcCsptj||dddd|dddd|dddd|dddd|dd dd |dd dd |dd dd |d ddd|dddd|dddd|dddd|dddd|dddd|dddd|dddd |dddd |dddd|dddd|dddd|dddd|dddd|dddddS) NrufĂaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarfindrorlr{r|r}uh􀌄aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarpr~rrrr8 rPaĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂria􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄Ă􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄rr_aĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂ_a_a􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄_Ă􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄_ĂĂa􀌄a􀌄Ă)rrv test_rfindrxr-r!rrr rs. zUnicodeTest.test_rfindcCsXtj||dddd|dddd|dddd|ddddd |tdjd |td jdd |td jd d|td jd d|dddd|dddd|dddd|tdjd|tdjd|tdjd|dddd|dddd|dddd|tdjd|tdjd|tdjd dS)!NrrindexrPrgrr8rrkhibZ abcdefghiab abcdefghighirlryrrirrrorrprrrqrrrrrsrtru)rrv test_indexr-r2 ValueErrorrrxr!rrr rs* zUnicodeTest.test_indexcCsrtj||dddd|dddd|dddd|d dddd d |tdjd |td jdd |td jdd d |tdjdd d|tdjdd d |d ddd|d ddd|d ddd|tdjd|tdjd|tdjd|d ddd|d ddd|d ddd|tdjd|tdjd|tdjd dS)!NrrrindexrPrgrrr8rrlrZ defghiabcrkrrrrrirrrorrprrrrrrrrr)rrv test_rindexr-r2rrrxr!rrr rs, zUnicodeTest.test_rindexc Cs0|dddtddi|dddtddtdtdi|dddtddtdtdtd d i|d ddtddtdd i|d d dtddi|dddddi|jddd}|ddd||jddd}|ddd||dtddd|dtddid|dtddid|dtddid|dtddid|d tdd!dd"|d tdddd#|dtdd$id%|dtddid|dtddid|dtdd!id&|d'tdd(id)d*}d+D],}t||i}d,|}|t|j|qP|t |jj|t|jjdd-|t |jjd.d/|t |jjdd.|t |jjdd/d.|t|jjd0d.i|t |jjd1d.i|t d2j|t djdddS)3NZbbbcZabababc translateriZiiicrjiZiiixcxrPZxyyxZxzxzZyyzrirjz cr8ZxyzdZxyzzyZ abdcdcbddddz[a]Xz[X][]ZXXXz[XXX]éu[é]Zaxb123Zx123uxéu<é>u[<é>]z[123]u[aé]u<€>u [<€>é]r0u aé€􏿿z[%s]ZdefgrmrZxy)rkr) r-ord type2test maketransr&rrr2rr])r"ZtblZ invalid_charbeforemappingrrrr test_maketrans_translate9s        z$UnicodeTest.test_maketrans_translatec Cstj|dD]\}}|d9}|d9}dD]|}|||g||d||||g|||d||||g||d|d|||g||d|d|dq,qdS)NZbauāĀu𐌁𐌀rrrou𐌂splitrm)rrv test_splitrxr"leftrightdelimrrr rs"       zUnicodeTest.test_splitc Cstj|dD]\}}|d9}|d9}dD]|}|||g||d||||g|||d||||g||d|d|||g||d|d|dq,qdS)Nrrrrsplitrm)rrv test_rsplitrxrrrr rs"       zUnicodeTest.test_rsplitc Cstj||dddddD]\}}|d9}|d9}dD]}|||ddf||d|||||f|||d||||ddf||d|d |||d |f||d |d|d q.MyWrappercSs ||_dSNsval)r"rrrr __init__z1UnicodeTest.test_join..MyWrapper.__init__cSs|jSrrr!rrr __str__rz0UnicodeTest.test_join..MyWrapper.__str__Nrrrrrrrrr MyWrappersrza b c dr1rY)rirjrrabcdrPzw x y zZwxyz12foo3)rkrmrg)rrrg)rr test_joinr-Sequence checkraisesr]bytes)r"rrrr rs zUnicodeTest.test_joinlz*needs too much memory on a 64-bit platformcCs4ttjdd}d|f|}|tdj|dS)Ng?rkArP)intrUmaxsizer2 OverflowErrorrY)r"sizeseqrrr test_join_overflowszUnicodeTest.test_join_overflowc Cstj||dddddd|tdjddd D]\}}|d 9}|d 9}d D]}d D]}|||||d|||||||||d|||||||d|d |||||||d |d|d |qZqRq6dS)Nzone@two!three!zone!two!three!replace!@rkrrrrr)ruău𐌃rm)rrv test_replacer-r2r]rrx)r"rrrreplrrr rs,       zUnicodeTest.test_replacecCs d}d}|||||dS)Nr8zabc def)assertIsr)r"patternrrrr test_replace_idszUnicodeTest.test_replace_idcCstdtdt|ddkd|ddkd|dtdkd|dtdkdWdn1sr0YdS)Nignorer8abcFT)rZcheck_warningswarnings simplefilter BytesWarningr& bytearrayr!rrr test_bytes_comparisons   z!UnicodeTest.test_bytes_comparisoncs:ddddkddkddkdS)Nr8ru)r&r'r!r)r"Z test_fixupZ test_lecmpr test_comparisons 5zUnicodeTest.test_comparisoncst|ddd|d|d|d|d|d|d |d |d dS) NFῼislowerⅧⅷ𐐁𐐧𐐩𐑎🐍👯)super test_islowerr- assertFalserr'r! __class__rr r=s zUnicodeTest.test_islowercsttjds$|ddd|d|d|d|d|d |d |d |d dS) Nr7Frisupperrrrrrrrr) r test_isupperrUrVrWr-r'rrr!rrr rLs  zUnicodeTest.test_isuppercsft|ddd|ddd|d|ddD]}||d|qFdS) NTristitleuGreek ῼitlecases ...u𐐁𐐩u𐐧𐑎)rrrrz{!a} is not title)r test_istitler-r'rrformatr"chrrr r\s zUnicodeTest.test_istitlecsXt|ddd|ddd|ddddD]}||d|q8dS) NTu isspaceu Fu—rrrrrrz{!a} is not space.)r test_isspacer-rrrrrrr r hs  zUnicodeTest.test_isspaceZcpucCsPttjdD]<}t|}t|}t|}|||dvpF|dkqdS)Nrk)ZWSBSZZs) r\rU maxunicoder[ unicodedata bidirectionalcategoryr&r)r"Z codepointcharrrrrr test_isspace_invariantrs   z"UnicodeTest.test_isspace_invariantcs.tdD]}||d|qdS)N)rrrr𝟶𑁦𐒠🄇z{!a} is alnum.)r test_isalnumr'isalnumrrrrr r|s zUnicodeTest.test_isalnumcspt|ddd|d|d|d|d|d|d dS) NTrisalpharrrrrr)r test_isalphar-r'rrr!rrr rs zUnicodeTest.test_isalphacs*t|d|ddS)N€􏿿)r test_isasciirisasciir!rrr rs zUnicodeTest.test_isasciicCs|ddd|ddd|ddd|ddd|ddd|dd d|dd d|dd d|td dd dD]}||d|qdD]}||d|qdS)NFrP isdecimalriT0①¼٠ 0123456789 0123456789ar8r)rrrrrr𑁥rz{!a} is not decimal.)rrrz{!a} is decimal.)r-rr]rrrr'rrrr test_isdecimalszUnicodeTest.test_isdecimalcsxt|ddd|ddd|ddddD]}||d|q8d D]}||d |qXdS) NTr isdigitFr!r")rrrrrrr%z{!a} is not a digit.)rrrrz{!a} is a digit.)r test_isdigitr-rr'rr'rrrr r(s zUnicodeTest.test_isdigitcCs|ddd|ddd|ddd|ddd|ddd|dd d|dd d|dd d|td jd dD]}||d|qdD]}||d|qdS)NFrP isnumericriTrr r!r"r#r$r8rrz{!a} is not numeric.)r%rrrrz{!a} is numeric.)r-r2r]r)rrr'rrrr test_isnumericszUnicodeTest.test_isnumericcCs|d|d|d|d|d|d|d|d|d |d |d |d dS) NriZ_Zb0ZbcZb_µu𝔘𝔫𝔦𝔠𝔬𝔡𝔢r1[©r)r' isidentifierrr!rrr test_isidentifierszUnicodeTest.test_isidentifiercCs2ddl}d}|||||dS)Nru𝖀𝖓𝖎𝖈𝖔𝖉𝖊) _testcapir'r0Zunicode_legacy_string)r"r2urrr test_isidentifier_legacysz$UnicodeTest.test_isidentifier_legacycCs|d|d|d|d|d|d|d|d|d dS) NrPr1abcdefgzabcdefg ʹ͸ru󠀠)r' isprintablerr!rrr test_isprintableszUnicodeTest.test_isprintablecCsdD].}||||||qdD].}||||||q8dD]0}tt|}dD]}|||d||fq~qldD]0}tt|}dD]}|||d||fqqdS)N)abab aba aba)uABuABu ABAu ABA)rrr)r8z%a.%s() is False)rrr'rrr)r0r9)r8r?r@rAr;r<r=r>)r'rrrrr%r)r"sZ meth_namemethrrr test_surrogatess   zUnicodeTest.test_surrogatescCstj||dd|dd|dd|dd|dd|d d |d d |d d|dd|dd|dd|dd|dd|dd|dddS)Nr𐑏𐐧𐐧𐑏𐑏𐐧𐑏 X𐐧x𐑏u x𐑏x𐑏fiİi̇ΣσͅΣuͅσAͅΣuaͅςAͅΣauaͅσaAΣͅuaςͅΣͅ uσͅ 򏿾r)rrv test_lowerr&lowerr!rrr rUs,    zUnicodeTest.test_lowercCst|dd|dd|dd|dd|dd|d d |d d dS) NrZhELloßssrJfirMrNrPuaισr-uμ)r&casefoldr!rrr test_casefoldszUnicodeTest.test_casefoldcCstj||dd|dd|dd|dd|dd |d d |d d |d d |dd|dd|dddS)NrErrGrFrHrIu X𐐧X𐐧rJFIrKrMrWSSῒΪ̀rTrr)rrv test_upperr&upperr!rrr r`#s$    zUnicodeTest.test_uppercCstj||dd|dd|dd|dd|dd|dd d }|d ||d d |dddS)NrErrGrH𐑏𐐧rIu X𐑏x𐑏uhİuHi̇u Ϊ̀i̇uῒİufinnishFinnishrPuAͅς)rrvtest_capitalizer& capitalize)r"exprrr rd4s&     zUnicodeTest.test_capitalizecst|dd|dd|dd|dd|dd|dd |d d |d d |dddS)NrErrGrHu𐑏𐑏 𐑏𐑏u𐐧𐑏 𐐧𐑏u𐑏𐐧 𐑏𐐧uX𐐧x𐑏 X𐐧x𐑏uX𐑏x𐑏 X𐑏x𐑏ufiNNISHrcu AΣ ᾡxyu Aς ᾩxyuAΣAuAσa)r test_titler&titler!rrr rgEs(      zUnicodeTest.test_titlecCs0tj||dd|dd|dd|dd|dd|dd|d d |d d |d d|dd|dd|dd|dd|dd|dd|d d|dd|dddS)NrErrGrFrHrbrIu x𐑏X𐐧rJr\rKrLrMrNrOuΙσrPuaΙςrQuaΙσArRuaςΙrSuσΙ rWr]r^r_)rrv test_swapcaser&swapcaser!rrr riVs6     zUnicodeTest.test_swapcasecCsLtj||dddd|dddd|dddddS) Nrrmrux􏿿rgu 􏿿x􏿿ru 􏿿x􏿿􏿿)rrv test_centerr&centerr!rrr rkps zUnicodeTest.test_centerizrequires 32-bit systemcCsTd}z d|}Wn$ty4|d|dYn0z|t|jW~n~0dS)NiVUUüz$no enough memory (%.0f MiB required)) MemoryErrorZskipTestr2rra)r"rrBrrr test_case_operation_overflowys  z(UnicodeTest.test_case_operation_overflowcCs|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd |dd |d d |d d |d d|d d|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|tdjdD]^}|d9}dD]J}|||||||||d|||d||dqZqJdS)NriZabdbZbdabZbdabaZbdbaZbdb)rirkN)rkNri)rrky)rrkNrZabcxxxxabr8)rkNrrrPzabcabcZasdfZasd)riĀu𐌀rrrm)assertInZ assertNotInr2r] __contains__)r"fillrrrr test_containssD                           zUnicodeTest.test_containscCsXddddddddddddddddS)N𐀀􀀀􀀀rg𐀀) rVrZrarerhrjrlljustrjustr!rrr test_issue18183s  zUnicodeTest.test_issue18183c Cs |dd|dd|dd|dd|dd|dd |d d |d d ddl}|ddd|dtddd|ddd|ddd}|d|dGddd}Gddd}Gdd d }Gd!d"d"}Gd#d$d$}Gd%d&d&|j}Gd'd(d(t} Gd)d*d*} Gd+d,d,} |dd|d-d-|d.d-d-|d/d-d-|d0d-d1|d2d-d3|d4d-d5|d6d7d-d-|d8d7d-d1|d9d7d-d3|d:d7d-d5|d.d;d<|d=d;d-d>|d?d;d-d@|dAdB|dCdD|dEdF|dGdH|dIdJdK|dLdM|dNdO|dPdQ|dRdSdTidT|dUdVdTidT|dWdXdYidZ|d[j|d\d]d^|d_|d`|d\da|db||d-d-|dcd-ddgd-|ded-ddgdd|dfd-ddggdd|dgd-|ddggdd|dhd-d-|dhdd|dhdid-|djdid|dkd-d-|dld-d-|dmd-d|dnd-do|dpdqdq|drdqdq|dsdqdq|dtdqdu|dvdqdw|dxdqdy|dzdqdy|d{dqd||d}dqd~|ddqd|ddqd|ddqd|ddddXd|dddXd|dddXd|ddd|ddd|ddd|ddd|ddYd|ddYd|ddYd|ddYd|ddd|ddd|ddd|ddd|ddd|ddd|ddd|ddd|d|d-|ddd|ddd|ddd|ddd|ddd|ddd|d|dd|ddd|ddd|d|dd|ddd|ddd|ddd|ddd|d|dd|d|dd|d.idF|d.gd|d.d7gd|d|dd¡|d|ddá|tdj|d|tdj|d|tdj|d|dƠ|ddddȍdɡ|d.| d`d^|d/dd|dʠdd̡d͡|dΠdd̡d͡|djdddЍd͡|djdd`ddҍdӡ|djddddҍdӡ|tdBj|tdDj|tdj|tdj|tdj|tdj|t d.j|t d6jd-|t dHj|tdOj|tdj|tdj|t dj|tdjd|tdj|tdjg|t dj|tdjd|tdjd|tdjd|tdjd|t dj|tdjd|tdjd|jt djdYd|tdjdY|tdjd|tdjd|tdj|t dj|t dj|t dFjd} |tdB| dDj|td| djdg|tdjdg|tdjdg|tdjdd|tdjd-dd|tdjdd7ddYdddd d} | t| djd| t| tddd}| t|djd|tdjd|ttdd|ttdd|dddd|dhdd|djdd|ddFdidա|ddFdid|ddBdid|ddDdid|d d did|d d did|td jd|tdjd|tdjd|dddd| d}|d|d|tdj||tdFj|| d}|d|d|d|d|tdFj|dS(NrPrirra{{a{a}}a}{{b{b}}b}ba{{ba{brzMy name is {0}ZFredzMy name is FredzMy name is {0[name]})namezMy name is {0} :-{{}}zMy name is Fred :-{}irzThe year is {0.year}zThe year is 2007c@seZdZdddZddZdS)z"UnicodeTest.test_format..CrycSs ||_dSrZ_xr"rrrr rsz+UnicodeTest.test_format..C.__init__cSs|Srrr"specrrr __format__sz-UnicodeTest.test_format..C.__format__N)ryrrrrrrrrr Cs rc@seZdZddZddZdS)z"UnicodeTest.test_format..DcSs ||_dSrrrrrr rsz+UnicodeTest.test_format..D.__init__cSs t|jSr)rrrrrr rsz-UnicodeTest.test_format..D.__format__Nrrrrr Dsrc@seZdZddZddZdS)z"UnicodeTest.test_format..EcSs ||_dSrrrrrr rsz+UnicodeTest.test_format..E.__init__cSsd|jdS)NzE()rr!rrr rsz*UnicodeTest.test_format..E.__str__Nrrrrr Esrc@seZdZddZddZdS)z"UnicodeTest.test_format..FcSs ||_dSrrrrrr rsz+UnicodeTest.test_format..F.__init__cSsd|jdS)NzF(rrr!rrr r sz+UnicodeTest.test_format..F.__repr__N)rrrrr rrrr Fsrc@s$eZdZddZddZddZdS)z"UnicodeTest.test_format..GcSs ||_dSrrrrrr rsz+UnicodeTest.test_format..G.__init__cSs d|jS)Nz string is rr!rrr rsz*UnicodeTest.test_format..G.__str__cSs"|dkrd|jdSt||S)NrzG(r)rr*rr" format_specrrr rsz-UnicodeTest.test_format..G.__format__N)rrrrrrrrrr Gsrc@seZdZddZdS)z"UnicodeTest.test_format..IcSs ||Sr)strftimerrrr rsz-UnicodeTest.test_format..I.__format__Nrrrrrrrr Isrc@seZdZddZdS)z"UnicodeTest.test_format..JcSst|d|SNrm)rrrrrr rsz-UnicodeTest.test_format..J.__format__Nrrrrr Jsrc@s eZdZddZddZdZdS)z"UnicodeTest.test_format..McSs ||_dSrrrrrr rsz+UnicodeTest.test_format..M.__init__cSsd|jdS)NzM(rrr!rrr r sz+UnicodeTest.test_format..M.__repr__N)rrrrr rrrrr Msrc@s eZdZddZddZdZdS)z"UnicodeTest.test_format..NcSs ||_dSrrrrrr rsz+UnicodeTest.test_format..N.__init__cSsd|jdS)NzN(rrr!rrr r sz+UnicodeTest.test_format..N.__repr__N)rrrrr rrrrr Nsrr8{0}z{0:}zX{0}ZXabcz{0}XZabcXzX{0}YZXabcYz{1}rkzX{1}z{1}XzX{1}Yiz-15z{0}{1}z-15abcz{0}X{1}z-15Xabcz{{{z}}}z{{}}{}z{{x}}z{x}z{{{0}}}{z{123}z {{{{0}}}}z{{0}}z}}{{z}{z}}x{{z}x{z {0[foo-bar]}zfoo-barZbazz {0[foo bar]}zfoo barz{0[ ]}r1rgr{foo._x})r20z{1}{0}rnZ2010z{0._x.x}z{0[0]}rz{0[1]}z {0[1][0]}z {0[1][0].x}z{0:.3s}abcdefz{0:.0s}z{0:3.3s}z{0:2.3s}z{0:2.2s}z{0:3.2s}zab z{0:x<0s}r)z{0:x<5s}z{0:x<6s}z{0:x<7s}Zresultxz{0:x<8s}Zresultxxz{0: <7s}zresult z{0:<7s}z{0:>7s}z resultz{0:>8s}z resultz{0:^8s}z result z{0:^9s}z result z{0:^10s}z result z {0:10000}i'i'z {0:10000000}iz{0:<6s}rzfooz{0:<6s}zfooz{0:^6s}zfooz{0:^6s}z foo z{0:<6}z3z{0:<6}z3z{0:^6}z3z{0:<6}z3 Q @z3.14z3.14z3.14z{0:^6}z 3.14 z{0:<12}y@@z (3+2j)z{0:<12}z (3+2j)z{0:^12}z (3+2j)z{0:^12}z (3+2j) z{0:abc}z{0!s}ZHelloz{0!s:}z{0!s:15}zHello z {0!s:15s}z{0!r}z'Hello'z{0!r:}zF(Hello)r7z'\u0378'r6u'ʹ'uF(ʹ)z{0!a}z'\u0374'z{0!a:}z F(\u0374)rz[1]z{0:d}datazG(data)zstring is dataz{0:^10}z{0:>15s}z{0:date: %Y-%m-%d})ZyearZmonthZdayzdate: 2007-08-27z{0:.{1}} hello worldrz {0:.{1}s}z{0:.{precision}s}) precisionz{0:{width}.{precision}s})widthrz hello 105{a}azabc{0:{}z{0z{0.}z{0[}z{0]}z{0.[]}z{0..foo}z{0[0}z {0[0:foo}z{c]}z {{ {{{0}}z{0}}z{foo})barz{0!x}z{0!}z{0!rs}z{!}z{:}z{:s}Z,23098475029384702983476098230754973209482573z{[z]}z{0[0]x}z {0[0](10)}z{0[{1}]}r5rz {0:{1:{2}}}rBz{0:{1:{2:{3:{4:{5:{6}}}}}}}rmz+Sign not allowed in string format specifierz{0:-s}-z,Space not allowed in string format specifierz{: }z{0:=s}#z#20z {0:s}{1:s}ABCuАБВu ABCАБВz{[{}]}z{[{]}z{[}]}z{[[]}r.z{[!]}rz{a{}b}rz{a{b}z{[}z 0x{:0{:d}X}Z0x0000000000000000{!r}zM(data)z{!s}zN(data)) r&rdatetimedictdaterr2r]r IndexErrorKeyErrorassertRaisesRegex)r"rrrrrrrrrrrbigZsign_msgZ space_msgmnrrr test_formats     zUnicodeTest.test_formatcCs|did|did|did|did|did|did |d id |d id Gdddt}|d|d|d|dddGddd}|d|dGddd}|dd|did|tdj|tdj|tdji|tdji|tdji|tdji|td ji|td!ji|td"jdd#i|td"jd|td$jd#d%d&Gd'd(d(}|tdji|tdjg|tdj|dS))NrPrirrrrrrrrrrrrc@seZdZddZdS)z,UnicodeTest.test_format_map..MappingcSs|Srrr"keyrrr __missing__sz8UnicodeTest.test_format_map..Mapping.__missing__N)rrrrrrrr Mappingsrz{hello}rz {a} {world})rirc@seZdZddZddZdS)z4UnicodeTest.test_format_map..InternalMappingcSsddi|_dS)Nrirrr!rrr rsz=UnicodeTest.test_format_map..InternalMapping.__init__cSs |j|Srrrrrr __getitem__sz@UnicodeTest.test_format_map..InternalMapping.__getitem__N)rrrrrrrrr InternalMappingsrz{a}c@seZdZdddZddZdS)z&UnicodeTest.test_format_map..CrycSs ||_dSrrrrrr rsz/UnicodeTest.test_format_map..C.__init__cSs|Srrrrrr r sz1UnicodeTest.test_format_map..C.__format__N)ryrrrrr rs rrrrrrrrrrrmz{a} {}rkrc@seZdZddZdS)z/UnicodeTest.test_format_map..BadMappingcSsddS)Nrkrrrrrr rsz;UnicodeTest.test_format_map..BadMapping.__getitem__N)rrrrrrrr BadMappingsr)r& format_maprr2r]rrZeroDivisionError)r"rrrrrrr test_format_maps<zUnicodeTest.test_format_mapcCsHdtjd}|ttd|}Wdn1s:0YdS)Nz.{}frkQ@rrUrr2rr" format_stringr)rrr test_format_huge_precision$s z&UnicodeTest.test_format_huge_precisioncCsHdtjd}|ttd|}Wdn1s:0YdS)Nz{}frkrrrrrr test_format_huge_width)s z"UnicodeTest.test_format_huge_widthcCsHdtjd}|t|d}Wdn1s:0YdS)Nz {{{}:.6f}}rkrrrrrr test_format_huge_item_number.s z(UnicodeTest.test_format_huge_item_numbercCspGddd}|ddd|ddd|d dd |d |dd|d d dgd|ddddd|ddd d|dddd|dddd|tdjd d|td jd d|td!jd d|td"jd d|d#jdd$d%d&|d'jdd$d%d(|d)jd d*d+dd,d-|d.jddd d+d/d0dS)1Nc@seZdZdddZddZdS)z1UnicodeTest.test_format_auto_numbering..CrycSs ||_dSrrrrrr r5sz:UnicodeTest.test_format_auto_numbering..C.__init__cSs|Srrrrrr r7sz.C.__format__N)ryrrrrr r4s rrrnrz{:5}rBzs rz's'z{._x}z{[1]}rkrmrz{[a]}rr4za{}b{}crZa0b1cza{:{}}brz^10z a x bza{:{}x}brrZa0x14bz{}{1}z{1}{}z{:{1}}z{0:{}}z{f}{}test)fZtest4z{}{f}Z4testz {:{f}}{g}{}rgg)rrz 1g3z {f:{}}{}{g})rrz 14g)r&rr2r)r"rrrr test_format_auto_numbering3s$z&UnicodeTest.test_format_auto_numberingcCs tj||ddd|ddd|ddd|dd d |dd d |dd dtjds|ddd|ddd|ddd|ddddd|ddddd|dd d!|dd"d#|tdj d$|dd#d#|t dj d%|t d&j d'|t d(j d%|d)d*did+|d)d*did+|d)d*did+|d)d*did+|d)dd,d-d+|d)dd,d-d+|d.d/d0|d1d/d2|d3dd+|d4d5d6|d4d7d8|d9d:d;|d9d<d6|d=d>d?|d@dAdB|ddCdCGdDdEdE}|dF|d!t dG}t dH}|dI|dG|dJ|dK|dI|dH|dJ|dL|dMdNdC|dOdNdPGdQdRdR}GdSdTdT}|dU}|dV}|dWdXdY|dZd[d\|d]d^d_|ddVd`|dW|da|dZ|db|d]|dc|d|d`| t ddtjdWdef| t dftjdZdgf| t dhtjd]dif| t djtjdW|f|t tjd|fdS)kN%s, %s)r8r8zabc, abcz%s, %s, %i, %f, %5.2f)r8r8rkrmrgzabc, abc, 1, 2.000000, 3.00)r8r8rkrgzabc, abc, 1, -2.000000, 3.00)r8r8rlrg @zabc, abc, -1, -2.000000, 3.50)r8r8rlrg(\ @zabc, abc, -1, -2.000000, 3.57)r8r8rlrg(\\@z abc, abc, -1, -2.000000, 1003.57r7z%r, %r)rr8z b'abc', 'abc'z%r)ሴu'ሴ'z%az'\u1234'z %(x)s, %(y)sr8r)rrqzabc, defu %(x)s, %(ü)s)rrmz%ci4riu𡒃)r0Zaau%.1ဲfgUUUUUU?z%i ...%(foo)s...rz ...abc...rrrz...%s...%s...%s...%s...)rkrmrgr8z...1...2...3...abc...z"...%%...%%s...%s...%s...%s...%s...z...%...%s...1...2...3...abc...z...%s...z%*s)rr8z abc)r8zabc z%*.*s)rrmr8z ab)rrgr8z%i %*.*s)rnrrgr8z10 abcz %i%s %*.*s)rnrgrrgr8z 103 abcric@seZdZddZdS)z,UnicodeTest.test_formatting..WrappercSsdS)Nrrr!rrr r{sz4UnicodeTest.test_formatting..Wrapper.__str__Nrrrrrrrr Wrapperzsr%snaninfz%fz%FNANINFz%.1suaé€z%.2suaéc@s$eZdZddZddZddZdS)z.UnicodeTest.test_formatting..PseudoIntcSst||_dSrrvaluer"rrrr rsz7UnicodeTest.test_formatting..PseudoInt.__init__cSs|jSrrr!rrr __int__sz6UnicodeTest.test_formatting..PseudoInt.__int__cSs|jSrrr!rrr __index__sz8UnicodeTest.test_formatting..PseudoInt.__index__N)rrrrrrrrrr PseudoIntsrc@seZdZddZddZdS)z0UnicodeTest.test_formatting..PseudoFloatcSst||_dSr)floatrrrrr rsz9UnicodeTest.test_formatting..PseudoFloat.__init__cSs t|jSrrr!rrr rsz8UnicodeTest.test_formatting..PseudoFloat.__int__N)rrrrrrrrr PseudoFloatsrgo! @mz%xrZ2az%Xrz%orZ11rZ6dZ6DZ155z,%x format: an integer is required, not floatrz,%X format: an integer is required, not floatgzG@z,%o format: an integer is required, not floatgp= ף?z2%x format: an integer is required, not PseudoFloat)rrtest_formattingr&rUrVrWr2r__mod__r]rrroperatormod)r"rrrrrpiZletter_mrrr rQs~  zUnicodeTest.test_formattingc Csddl}Gdddt|j}Gddd|j}Gdddt|j}|d|j|jfd |d |j|j|j|j|j|j|jfd |d d |jid|d d |jid|dd |jid|dd |jid|d|j|jdd|d|jddddS)Nrc@seZdZdZdS)z4UnicodeTest.test_formatting_with_enum..FloatgJM! @N)rrrPIrrrr Floatsrc@seZdZdZdS)z2UnicodeTest.test_formatting_with_enum..IntrN)rrrIDESrrrr Intsrc@seZdZdZdS)z2UnicodeTest.test_formatting_with_enum..Strr8N)rrrrrrrr StrsrrzStr.ABC, Str.ABCz%s, %s, %d, %i, %u, %f, %5.2fz-Str.ABC, Str.ABC, 15, 15, 15, 3.141593, 3.14rrz ...Str.ABC...z...Int.IDES...z ...%(foo)i...z...15...z ...%(foo)d...z ...%(foo)u...rz ...%(foo)f...rz...3.141593...) enumrEnumIntEnumrr&rrr)r"rrrrrrr test_formatting_with_enumsB z%UnicodeTest.test_formatting_with_enumcCsFdtjd}|t|d}Wdn1s80YdS)N%.{}frkrrrrrr test_formatting_huge_precisions z*UnicodeTest.test_formatting_huge_precisioncCs(Gdddt}|d|dddS)Nc@seZdZddZdS)zBUnicodeTest.test_issue28598_strsubclass_rhs..SubclassedStrcSs d|S)Nz'Success, self.__rmod__({!r}) was calledr)r"otherrrr __rmod__szKUnicodeTest.test_issue28598_strsubclass_rhs..SubclassedStr.__rmod__N)rrrr rrrr SubclassedStrsr z lhs %% %rZrhsz.Success, self.__rmod__('lhs %% %r') was calledrr&)r"r rrr test_issue28598_strsubclass_rhssz+UnicodeTest.test_issue28598_strsubclass_rhscCsPddlm}d|d}|t|d}Wdn1sB0YdS)Nr)INT_MAXrrkr)r2r rr2r)r"r rr)rrr 'test_formatting_huge_precision_c_limitss  z3UnicodeTest.test_formatting_huge_precision_c_limitscCsFdtjd}|t|d}Wdn1s80YdS)Nz%{}frkrrrrrr test_formatting_huge_widths z&UnicodeTest.test_formatting_huge_widthc CsldjdjfD]Z}|t}|dgWdn1s:0Yt|j}|d||d|q dS)Nrrrtuple)rWendswithr2r]r exceptionrv)r"rCcmexcrrr test_startswith_endswith_errorss  (  z+UnicodeTest.test_startswith_endswith_errorsLC_ALLde_DEfr_FRcCs|ddddS)Nz1.0z%.1fg?r&r!rrr test_format_floatszUnicodeTest.test_format_floatcCs^|tdddD]\}t|}|t|||t|t||dkr||dd||ddq|tddGddd}|t|d d |d }|t|d |t|d d D]}|t|tt|qtjd s|t td dd|tddddtjd sH|tt dddd|t tddddS)Nzunicode remains unicode)rXrrrrXsasciiutf-8z strings are converted to unicodec@seZdZddZddZdS)z2UnicodeTest.test_constructor..StringCompatcSs ||_dSrrrrrr rsz;UnicodeTest.test_constructor..StringCompat.__init__cSs|jSrrr!rrr rsz:UnicodeTest.test_constructor..StringCompat.__str__Nrrrrr StringCompatsrz)__str__ compatible objects are recognizedz#unicode(obj) is compatible to str())rg^@rr7z!decoding unicode is not supportedrsstrings are decoded to unicodezstrings are decoded to unicodes(character buffers are decoded to unicodez(character buffers are decoded to unicoder) r&rrlenrrUrVrWr2r] memoryview)r"rsubclassroobjrrr test_constructors^   zUnicodeTest.test_constructorcCsR|tddd|tdddd|tdddd|tddddd S) z>Pass various keyword argument combinations to the constructor.r)r*sfoor)r*rrr )r*r N)r&rr!rrr test_constructor_keyword_args5sz)UnicodeTest.test_constructor_keyword_argscCsT|td|tddddd}|t|ddd|jtt|dddS) z(Check the constructor argument defaults.rPrr#¢rrX)rN)r&rrr2UnicodeDecodeError)r"Z utf8_centrrr test_constructor_defaults>s  z%UnicodeTest.test_constructor_defaultscCsgd}|D]\}}||d|q |ddd|ddd|ddd|d dd |ddd|ddd|ddd|d dd |d dd |d dd |d dddd}d}|D]4}||d|d||dd|q|D]}||dd|q6|tdddWdn1s0YdS)N))uA≢Α.s A+ImIDkQ.)u Hi Mom -☺-!sHi Mom -+Jjo--!)u 日本語s +ZeVnLIqe-)uItem 3 is £1.sItem 3 is +AKM-1.)+s+-)z+-s+--z+?s+-?)z\?s+AFw?r))z\\?s+AFwAXA?)z\\\?s +AFwAXABc?)z++--s+-+---)u򫳞s+2m/c3g-)//utf-7us+2AE-uxs+2AE-xus+3AE-uxs+3AE-xu򫳞s +2AHab9ze-s+rrPzGABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?z!"#$%&*;<=>@[]^_`{|}utf7rXzill-formed sequences+@)r&rrrr&)r"ZutfTestsrrqZset_dZset_orrrr test_codecs_utf7Is2 zUnicodeTest.test_codecs_utf7cCs|ddd|ddd|ddd|ddd |d dd d |d dd d|ddd|ddd|td dd|tddd|tddddS)NrPrrrs€u𐀂s𐀂u𣑖s𣑖r8 surrogatepasssusu(𐀂𐀂𐀂𐀂𐀂𐀂𐀂𐀂𐀂𐀂s(𐀂𐀂𐀂𐀂𐀂𐀂𐀂𐀂𐀂𐀂u正確に言うと翻訳はされていません。一部はドイツ語ですが、あとはでたらめです。実際には「Wenn ist das Nunstuck git unds正確に言うと翻訳はされていません。一部はドイツ語ですが、あとはでたらめです。実際には「Wenn ist das Nunstuck git und)r&rrr!rrr test_codecs_utf8|s$ zUnicodeTest.test_codecs_utf8cCs,gd}|D]\}}||d|q dS)N) )rs)ari))s€€)s߿u߿)sࠀuࠀ)s퟿u퟿)su)￿r/)s𐀀r|)􏿿rr)r&r)r" sequencesrresrrr test_utf8_decode_valid_sequencess z,UnicodeTest.test_utf8_decode_valid_sequencesc CsddtddD}ddtddD}ddtdd D}|||d dtd d D}|D]}|t|jd q`|D]"}|D]}|t||jd qqz|D]D}|ddD]2}|ddD] } |t||d| jd qqqddtddDD]4}|td|djd |td|djd qddtddDD]6}|td|djd |td|djd qFddtddDD]6}|td|djd |td|djd qddtddDD]6}|td|djd |td|djd qdS)NcSsg|]}t|gqSrr.0rrrr rzBUnicodeTest.test_utf8_decode_invalid_sequences..cSsg|]}t|gqSrr;r<rrr r>rcSsg|]}t|gqSrr;r<rrr r>rcSsg|]}t|gqSrr;r<rrr r>rrQrrgcSsg|]}t|gqSrr;r<rrr r>rcSsg|]}t|gqSrr;r<rrr r>rcSsg|]}t|gqSrr;r<rrr r>rscSsg|]}t|gqSrr;r<rrr r>r)r\r2r&r) r"Zcontinuation_bytesZinvalid_2B_seq_start_bytesZinvalid_4B_seq_start_bytesZinvalid_start_bytesbyteZsbcbZcb1Zcb3rrr "test_utf8_decode_invalid_sequencess` z.UnicodeTest.test_utf8_decode_invalid_sequencesc?Csd}d|fd|dfd|fd|dfd|fd|dfd |dfd |fd |dfd |d fd|dfd|fd|dfd|d fd|dfd|fd|dfd|d|fd|dfd|dfd|ddfd|d|fd|fd|dfd|d fd |dfd!|d"fd#|fd$|fd%|dfd&|dfd'|dfd(|d|fd)|d|dfd*|d|dfd+|d|fd,|d|fd-|d|dfd.|ddfd/|d|dfd0|fd1|dfd2|dfd3|d fd4|dfd5|ddfd6|dd|fd7|d|ddfd8|fd9|dfd:|dfd;|ddfd<|d"fd=|fd>|dfd?|d fd@|dAfdB|fdC|d fdDdEdFdGg?}t|D]l\}\}}|t|jdHdI||dHdJ|||dKdHdJ|dL||dHdM|ddNqdS)ON�rErLrmsssssrgsArsssrssAsAsAAZAAsAsAsAssssrsssAsAAsAsAsAsAAsAAsAsAsAsAsssssAsAsAAsssAssssrs)sABCu�ABC)sBCu��BC)sCu�C)s abcdua���b�c��drrrbrjrrP) enumerater2r&rr&r)r"FFFDr8rrr9rrr test_issue8271s                               K zUnicodeTest.test_issue8271cCs|t}|dWdn1s*0Y|j}||t|||dd||d|dddd|d|dd }||dd ||d|ddd d|ddS) z Check that an invalid UTF-8 sequence raises a UnicodeDecodeError when 'strict' is used, returns res when 'replace' is used, and that doesn't return anything when 'ignore' is used. rNrsaaaasbbbbZaaaaZbbbbrQrPr)r2r&rrrvrr&r)r"rr9errrrrrr assertCorrectUTF8Decoding:s (   z%UnicodeTest.assertCorrectUTF8DecodingcCs&d}dD]}|t|gddqdS)ah Test that an 'invalid start byte' error is raised when the first byte is not in the ASCII range or is not a valid start byte of a 2-, 3-, or 4-bytes sequence. The invalid start byte is replaced with a single U+FFFD when errors='replace'. E.g. <80> is a continuation byte and can appear only after a start byte. rQszinvalid start byteN)r`r)r"r]rNrrr test_invalid_start_byteMs z#UnicodeTest.test_invalid_start_bytecCs.gd}d}|D]}|t|ddqdS)aa Test that an 'unexpected end of data' error is raised when the string ends after a start byte of a 2-, 3-, or 4-bytes sequence without having enough continuation bytes. The incomplete sequence is replaced with a single U+FFFD when errors='replace'. E.g. in the sequence , F3 is the start byte of a 4-bytes sequence, but it's followed by only 2 valid continuation bytes and the last continuation bytes is missing. Note: the continuation bytes must be all valid, if one of them is invalid another error will be raised. )&ZC2ZDFzE0 A0zE0 BFzE1 80zE1 BFzEC 80zEC BFzED 80zED 9FzEE 80zEE BFzEF 80zEF BFzF0 90zF0 BFzF0 90 80zF0 90 BFzF0 BF 80zF0 BF BFzF1 80zF1 BFzF1 80 80zF1 80 BFzF1 BF 80zF1 BF BFzF3 80zF3 BFzF3 80 80zF3 80 BFzF3 BF 80zF3 BF BFzF4 80zF4 8FzF4 80 80zF4 80 BFzF4 8F 80zF4 8F BFrQzunexpected end of dataNr`rfromhex)r"r8r]rrrr test_unexpected_end_of_dataZs  z'UnicodeTest.test_unexpected_end_of_datac Csvd}|d}d|dfd|dfd|fd|fd |dfd |dfd |fd |fg}|D]\}}|t||d qTdS)a Test that an 'invalid continuation byte' error is raised when the continuation byte of a 2-bytes sequence is invalid. The start byte is replaced by a single U+FFFD and the second byte is handled separately when errors='replace'. E.g. in the sequence , C2 is the start byte of a 2-bytes sequence, but 41 is not a valid continuation byte because it's the ASCII letter 'A'. rQrmzC2 00rszC2 7Fr4zC2 C0zC2 FFzDF 00zDF 7FzDF C0zDF FFinvalid continuation byteNrbr"r]ZFFFDx2r8rr9rrr test_invalid_cb_for_2bytes_seqts    z*UnicodeTest.test_invalid_cb_for_2bytes_seqcMCsd}|d}d|dfd|dfd|fd|fd |fd |fd |dfd |dfd |fd|fd|dfd|dfd|fd|fd|dfd|dfd|fd|fd|dfd|dfd|fd|fd|dfd|dfd|fd|fd|dfd |dfd!|fd"|fd#|dfd$|dfd%|fd&|fd'|dfd(|dfd)|fd*|fd+|dfd,|dfd-|fd.|fd/|fd0|fd1|dfd2|dfd3|fd4|fd5|dfd6|dfd7|fd8|fd9|dfd:|dfd;|fd<|fd=|dfd>|dfd?|fd@|fdA|dfdB|dfdC|fdD|fdE|dfdF|dfdG|fdH|fdI|dfdJ|dfdK|fdL|fdM|dfdN|dfdO|fdP|fgL}|D]\}}|t||dQqldRS)Sa Test that an 'invalid continuation byte' error is raised when the continuation byte(s) of a 3-bytes sequence are invalid. When errors='replace', if the first continuation byte is valid, the first two bytes (start byte + 1st cb) are replaced by a single U+FFFD and the third byte is handled separately, otherwise only the start byte is replaced with a U+FFFD and the other continuation bytes are handled separately. E.g. in the sequence , E1 is the start byte of a 3-bytes sequence, 80 is a valid continuation byte, but 41 is not a valid cb because it's the ASCII letter 'A'. Note: when the start byte is E0 or ED, the valid ranges for the first continuation byte are limited to A0..BF and 80..9F respectively. Python 2 used to consider all the bytes in range 80..BF valid when the start byte was ED. This is fixed in Python 3. rQrmzE0 00rszE0 7Fr4zE0 80zE0 9FzE0 C0zE0 FFzE0 A0 00zE0 A0 7FzE0 A0 C0zE0 A0 FFzE0 BF 00zE0 BF 7FzE0 BF C0zE0 BF FFzE1 00zE1 7FzE1 C0zE1 FFzE1 80 00zE1 80 7FzE1 80 C0zE1 80 FFzE1 BF 00zE1 BF 7FzE1 BF C0zE1 BF FFzEC 00zEC 7FzEC C0zEC FFzEC 80 00zEC 80 7FzEC 80 C0zEC 80 FFzEC BF 00zEC BF 7FzEC BF C0zEC BF FFzED 00zED 7FzED A0zED BFzED C0zED FFzED 80 00zED 80 7FzED 80 C0zED 80 FFzED 9F 00zED 9F 7FzED 9F C0zED 9F FFzEE 00zEE 7FzEE C0zEE FFzEE 80 00zEE 80 7FzEE 80 C0zEE 80 FFzEE BF 00zEE BF 7FzEE BF C0zEE BF FFzEF 00zEF 7FzEF C0zEF FFzEF 80 00zEF 80 7FzEF 80 C0zEF 80 FFzEF BF 00zEF BF 7FzEF BF C0zEF BF FFreNrbrfrrr test_invalid_cb_for_3bytes_seqsP        # z*UnicodeTest.test_invalid_cb_for_3bytes_seqcuCsd}|d}d|dfd|dfd|fd|fd |fd |fd |dfd |dfd |fd|fd|dfd|dfd|fd|fd|dfd|dfd|fd|fd|dfd|dfd|fd|fd|dfd|dfd|fd|fd|dfd |dfd!|fd"|fd#|dfd$|dfd%|fd&|fd'|dfd(|dfd)|fd*|fd+|dfd,|dfd-|fd.|fd/|dfd0|dfd1|fd2|fd3|dfd4|dfd5|fd6|fd7|dfd8|dfd9|fd:|fd;|dfd<|dfd=|fd>|fd?|dfd@|dfdA|fdB|fdC|dfdD|dfdE|fdF|fdG|dfdH|dfdI|fdJ|fdK|dfdL|dfdM|fdN|fdO|dfdP|dfdQ|fdR|fdS|dfdT|dfdU|fdV|fdW|dfdX|dfdY|fdZ|fd[|dfd\|dfd]|fd^|fd_|fd`|fda|dfdb|dfdc|fdd|fde|dfdf|dfdg|fdh|fdi|dfdj|dfdk|fdl|fdm|dfdn|dfdo|fdp|fdq|dfdr|dfds|fdt|fdu|dfdv|dfdw|fdx|fgt}|D]\}}|t||dyqdzS){at Test that an 'invalid continuation byte' error is raised when the continuation byte(s) of a 4-bytes sequence are invalid. When errors='replace',the start byte and all the following valid continuation bytes are replaced with a single U+FFFD, and all the bytes starting from the first invalid continuation bytes (included) are handled separately. E.g. in the sequence , E1 is the start byte of a 3-bytes sequence, 80 is a valid continuation byte, but 41 is not a valid cb because it's the ASCII letter 'A'. Note: when the start byte is E0 or ED, the valid ranges for the first continuation byte are limited to A0..BF and 80..9F respectively. However, when the start byte is ED, Python 2 considers all the bytes in range 80..BF valid. This is fixed in Python 3. rQrmzF0 00rszF0 7Fr4zF0 80zF0 8FzF0 C0zF0 FFzF0 90 00zF0 90 7FzF0 90 C0zF0 90 FFzF0 BF 00zF0 BF 7FzF0 BF C0zF0 BF FFz F0 90 80 00z F0 90 80 7Fz F0 90 80 C0z F0 90 80 FFz F0 90 BF 00z F0 90 BF 7Fz F0 90 BF C0z F0 90 BF FFz F0 BF 80 00z F0 BF 80 7Fz F0 BF 80 C0z F0 BF 80 FFz F0 BF BF 00z F0 BF BF 7Fz F0 BF BF C0z F0 BF BF FFzF1 00zF1 7FzF1 C0zF1 FFzF1 80 00zF1 80 7FzF1 80 C0zF1 80 FFzF1 BF 00zF1 BF 7FzF1 BF C0zF1 BF FFz F1 80 80 00z F1 80 80 7Fz F1 80 80 C0z F1 80 80 FFz F1 80 BF 00z F1 80 BF 7Fz F1 80 BF C0z F1 80 BF FFz F1 BF 80 00z F1 BF 80 7Fz F1 BF 80 C0z F1 BF 80 FFz F1 BF BF 00z F1 BF BF 7Fz F1 BF BF C0z F1 BF BF FFzF3 00zF3 7FzF3 C0zF3 FFzF3 80 00zF3 80 7FzF3 80 C0zF3 80 FFzF3 BF 00zF3 BF 7FzF3 BF C0zF3 BF FFz F3 80 80 00z F3 80 80 7Fz F3 80 80 C0z F3 80 80 FFz F3 80 BF 00z F3 80 BF 7Fz F3 80 BF C0z F3 80 BF FFz F3 BF 80 00z F3 BF 80 7Fz F3 BF 80 C0z F3 BF 80 FFz F3 BF BF 00z F3 BF BF 7Fz F3 BF BF C0z F3 BF BF FFzF4 00zF4 7FzF4 90zF4 BFzF4 C0zF4 FFzF4 80 00zF4 80 7FzF4 80 C0zF4 80 FFzF4 8F 00zF4 8F 7FzF4 8F C0zF4 8F FFz F4 80 80 00z F4 80 80 7Fz F4 80 80 C0z F4 80 80 FFz F4 80 BF 00z F4 80 BF 7Fz F4 80 BF C0z F4 80 BF FFz F4 8F 80 00z F4 8F 80 7Fz F4 8F 80 C0z F4 8F 80 FFz F4 8F BF 00z F4 8F BF 7Fz F4 8F BF C0z F4 8F BF FFreNrbrfrrr test_invalid_cb_for_4bytes_seqs|                  9 z*UnicodeTest.test_invalid_cb_for_4bytes_seqcCs|ddddS)Nzwww.python.org.Zidnaswww.python.org.)r&rr!rrr test_codecs_idnaszUnicodeTest.test_codecs_idnacCs|tdjd|tdjdd|dddd|dddd|ddddjddd|ddddjddd |ttd d|ttd dd|td ddd |td ddd |td ddd|dddd|tdjd|tdjd|ttdd|tdjd|tdjd|tdjddd|ttd|ttd|tt d|tt d|tt d|tt ddS)NuAndr‚ xrXrrsAndr xrsAndr? xr#)rr sAndr xzAndr xu Andr� xs xu� xs \N{foo}xxzunicode-escapexx\hellorrrrr8u) r2 UnicodeErrorrr&rrr]rrrcomplexr!rrr test_codecs_errorss8  zUnicodeTest.test_codecs_errorsc Cs|ddd|ddd|ddd|ddd|ddd|ddd |dd d|d d td D].}t|}dD]}|t||||qqtdD].}t|}dD]}|t||||qqtdD]2}t|}dD]}|t||||qqt8d}dD]}|t||||qLWdn1s0Ydttt tddt tdd}dD]}|t||||qdS)NrrXrmr,r utf-16-les hello utf-16-bes hellolatin-1u☃s☃i)r,rutf-16rqrrraw_unicode_escapeunicode_escaperQ)rsr?)rXu𐀁𠀂𰀃񀀄񐀅)rrtrqrrrurvrPriir0)r) r&rr\r[rrcatch_warningsrYrZlist)r"rr3rrrr test_codecs@s:     < zUnicodeTest.test_codecscCsbttd}dD]}|t||||qttdd}dD]}|t||||q@dS)Nr?)9cp037cp1026cp273cp437cp500cp720cp737cp775cp850cp852cp855cp858cp860cp861cp862cp863cp865cp866cp1125 iso8859_10 iso8859_13 iso8859_14 iso8859_15 iso8859_2 iso8859_3 iso8859_4 iso8859_5 iso8859_6 iso8859_7 iso8859_9koi8_rkoi8_tkoi8_ukz1048latin_1 mac_cyrillic mac_latin2cp1250cp1251cp1252cp1253cp1254cp1255cp1256cp1257cp1258Zcp856cp857cp864cp869Zcp874 mac_greek mac_iceland mac_roman mac_turkishZcp1006 iso8859_8rQ) rzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrr)rr\r&rr)r"rBrrrr test_codecs_charmapos  zUnicodeTest.test_codecs_charmapcCs@|dd|dd|dd|dd|dddS)Nrrrr!rrr test_concatenations     zUnicodeTest.test_concatenationcCsGddd}|}td|dtdd|dtdd|dtdd|dtd|dtdd|dtdd|dtd |dtd |ddS) Nc@seZdZddZdS)z,UnicodeTest.test_printing..BitBucketcSsdSrr)r"rrrr writesz2UnicodeTest.test_printing..BitBucket.writeN)rrrrrrrr BitBucketsrr8)filerzabc r1)endrzdef )print)r"routrrr test_printings   zUnicodeTest.test_printingc Csd}|dd}|||d}|dd}|||d}|dd}|||zddWn@ty}z(||jd||jdWYd}~nd}~00|ddS) Nr{zraw-unicode-escapes \U00100000s \U00010000s \U11111111rrnz%Should have raised UnicodeDecodeError)rrr&r&startrZfail)r"rrqerrr test_ucs4s   $zUnicodeTest.test_ucs4cCsGddd}Gdddt}Gdddt}|t|d|t|ddt|d}||d |t||t|d}||d |t|tdS) Nc@seZdZddZdS)z0UnicodeTest.test_conversion..ObjectToStrcSsdSNrrr!rrr rsz8UnicodeTest.test_conversion..ObjectToStr.__str__Nrrrrr ObjectToStrsrc@seZdZddZdS)z5UnicodeTest.test_conversion..StrSubclassToStrcSsdSrrr!rrr rsz=UnicodeTest.test_conversion..StrSubclassToStr.__str__Nrrrrr StrSubclassToStrsrc@seZdZdddZddZdS)z=UnicodeTest.test_conversion..StrSubclassToStrSubclassrPcSst|d|Sr)r__new__)clsZcontentrrr rszEUnicodeTest.test_conversion..StrSubclassToStrSubclass.__new__cSs|Srrr!rrr rszEUnicodeTest.test_conversion..StrSubclassToStrSubclass.__str__N)rP)rrrrrrrrr StrSubclassToStrSubclasss rrrZfoofoo)rr&rr(r)r"rrrrBrrr test_conversions    zUnicodeTest.test_conversioncCsDGddd}Gddd}|t|d|t|ddS)Nc@seZdZddZdS)z)UnicodeTest.test_unicode_repr..s1cSsdSN\nrr!rrr r sz2UnicodeTest.test_unicode_repr..s1.__repr__Nr#rrrr s1src@seZdZddZdS)z)UnicodeTest.test_unicode_repr..s2cSsdSrrr!rrr r sz2UnicodeTest.test_unicode_repr..s2.__repr__Nr#rrrr s2srrr&r`)r"rrrrr test_unicode_reprszUnicodeTest.test_unicode_reprcCs(|tddd|tdddS)Nr|z'%c')u𔀀z '\U00014000'rr!rrr test_printable_reprszUnicodeTest.test_printable_reprPrz only applies to 32-bit platformscCs|tdjtjdS)Nzt t )r2r expandtabsrUrr!rrr $test_expandtabs_overflows_gracefullysz0UnicodeTest.test_expandtabs_overflows_gracefullycCsd}|||dS)Nr8)rr)r"rBrrr test_expandtabs_optimization sz(UnicodeTest.test_expandtabs_optimizationcstddkrd}d}nd}d}dD]lt}|dkrBd }|}n|d krTd }|}nd }|}tj||fd d}|t||t|q$dS)Nrr0H$)rirrrrQrkrrmrcsSrrrrmaxlenrr  rz0UnicodeTest.test_raiseMemError..)structcalcsizerrUrr2ro)r"Zascii_struct_sizeZcompact_struct_sizecodeZ char_sizeZ struct_sizeZallocrrr test_raiseMemError s& zUnicodeTest.test_raiseMemErrorcCs>Gdddt}|d}|d|d|d|ddS)Nc@seZdZddZdS)z+UnicodeTest.test_format_subclass..ScSsdS)N__str__ overriddenrr!rrr r& sz3UnicodeTest.test_format_subclass..S.__str__Nrrrrr r % sr xxxrrr)rr&rr"r rBrrr test_format_subclass$ sz UnicodeTest.test_format_subclasscCsXGdddt}||d|ddGdddt}|d}|d7}||ddS)Nc@seZdZddZdS)(UnicodeTest.test_subclass_add..ScSsdSNrrr"r rrr __add__. sz0UnicodeTest.test_subclass_add..S.__add__N)rrrrrrrr r - sr rrrc@seZdZddZdS)rcSsdSrrrrrr __iadd__2 sz1UnicodeTest.test_subclass_add..S.__iadd__N)rrrrrrrr r 1 srr rrrr test_subclass_add, s zUnicodeTest.test_subclass_addcCs@d}|}||d|||d||t|ddS)Nr8rrk)__getnewargs__ assertIsNotr&r)r"rr+rrr test_getnewargs8 s zUnicodeTest.test_getnewargscCsjddlm}tdddD]L}d|d}||}||||d7}||}||||||qdS) Nr) getargs_urkryrrirjr)r2rr\r&r5)r"rlengthrr8rrrr test_resize? s    zUnicodeTest.test_resizecCsd}d|}d|}d|}d|}d|}d|}d|}d |} |||||||| f} t| d D]\} } | | u} || | k| || | k| | rd|| | k|| | kt| }t| }||||||k|||k|||k|||kqd|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k|||k||| k|||k|||k|||k||| kdS) Nrnrirr5r.rur/r{rrm) itertools combinationsr&r'rrr)r"rrXZascii2latinlatin2bmpbmp2ZastralZastral2stringsZtext1Ztext2ZequalZcopy1copy2rrr test_compareP sx zUnicodeTest.test_comparecCs t|ttt|ttdSr)rZcheck_free_after_iteratingiterrreversedr!rrr test_free_after_iterating sz%UnicodeTest.test_free_after_iteratingcCs`d}d}td|d|d|d|d|d|d |d }td d d |}||jd|dS)N)rXutf8latin1zBoom, Shaka Laka, Boom!z0 import sys encodings = zn for data in (b'', b'short string'): try: str(data, encoding=z) except LookupError: pass else: sys.exit(21) try: str(data, errors=z) except LookupError: pass else: sys.exit(22) for encoding in encodings: try: str(data, encoding, errors=z) except LookupError: pass else: sys.exit(22) for data in ('', 'short string'): try: data.encode(encoding=z) except LookupError: pass else: sys.exit(23) try: data.encode(errors=z) except LookupError: pass else: sys.exit(24) for encoding in encodings: try: data.encode(encoding, errors=z) except LookupError: pass else: sys.exit(24) sys.exit(10) z-Xdevz-crn)textwrapdedentrr&rc)r" encodingsinvalidrprocrrr test_check_encoding_errors s& $, 4z&UnicodeTest.test_check_encoding_errors)orrrrrr-r6r_rarfrwrrrrrrrrrrunittestZskipIfrUrrrr cpython_onlyrrrrrrr Zrequires_resourcerrrrr&r(r*r1r4r:rDrUr[r`rdrgrirkZ skipUnlessrpryrrrrrrrrrrr rrrZrun_with_localerr"r$r'r.r0r:rPr^r`rardrgrhrirjrpryrrrrrrrrrrrrrrrrrrr __classcell__rrrr r4s **F   ;           ' 67W     F  3%/Y :O)/7     Jrc@seZdZddZejddZejddZejddZejd d Z ejd d Z ejd dZ ejddZ ejddZ ejddZejddZdS)CAPITestcstdddlm}m}mm}m}m}m }m }m }m } m } m} m} d} t|| |f__fddfdd}|d d d td d d|dd|d|dd|dtd|dWdn1s0Y|dd|d|d|dd|dd|dd|dd|d d!d"|d#d$d%|d&d'd(d)|d*d+d,|d-d.d/|d0d1d,|d2d3d/|d4d5d/|d4d6d/|d4d7d/d|d&d8dd(d)|d9d:d#|d;dd#|d?d@d#|dAdBd#|dCdDd#|d?dEd#|dAdFd#|dCdGd#|d9dHd"|d;dId"|d=dJd"|d9dKd#|d;dLd#|d=dMd#|d9dNd#dO|d;dPd#dO|d=dQd#dO|dRdNddO|dSdPddO|dTdQddO|dUdV|dW|dXdY|dW|dZd[|d\|dZd]|d\|dZd^|d\|dZd_|d\|dZd`|d\|dZda|d\|dZdb|d\|dZdc|d\|ddde|df|dddg| df|dddh| df|dddi| dfdjdk||dl }| dl}|t|db|||t|db||djdk|| dl}|t|dh| |dm| dn|dddWdodp|df|dddqdr|df|dddqdods|df|dddtdodqdu|df|dddWdodv|df|dddqdw|df|dddqdodx|df|dddtdodqdy|df|dddWdodz|d{|dddqd||d{|dddqdod}|d{|dddtdodqd~|d{|ddd|ddd#d|dddd|dddd|ddd"|dd|dd|dW|ddd"|dd|ddddS)Nctypesr) c_char_p pythonapi py_objectsizeofc_intc_long c_longlong c_ssize_tc_uintc_ulong c_ulonglongc_size_tc_void_pPyUnicode_FromFormatcs&tfdd|D}|g|RS)Nc3s$|]}t|tr|n|VqdSr) isinstancer)r=arg)rrr szJCAPITest.test_from_format..PyUnicode_FromFormat..)r)rr+Zcargs)_PyUnicode_FromFormatrrr r s z7CAPITest.test_from_format..PyUnicode_FromFormatcs |g|R}||dSrr)Zexpectedrr+r)rr"rr check_format sz/CAPITest.test_from_format..check_formatuascii=unicodeés ascii=%Uu unicodeéz^^PyUnicode_FromFormatV\(\) expects an ASCII-encoded format string, got a non-ASCII byte: 0xe9$s unicode=%srXuꯍs%ciͫrr0rzs%c%crrn%%s%%rs%%sz[%]s[%%]z%abcs%%%srr8s%.3ssabcdefuabc[�s%.5suabc[€]rz '\u20acABC's%Au€ABCz'\u20s%.5Au €ABCDEFu'€ABC's%Ru'€As%.3Ru€ABs%.3Ss%.3Us%.3Vs%.5Vz repr= abcsrepr=%5Szrepr=abs repr=%.2Sz repr= abs repr=%5.2Sz repr= 'abc'srepr=%8Rzrepr='abs repr=%.3Rz repr= 'abs repr=%5.3Rsrepr=%8As repr=%.3As repr=%5.3Asrepr=%5ss repr=%.2ss repr=%5.2ssrepr=%5Us repr=%.2Us repr=%5.2Usrepr=%5V123s repr=%.2Vs repr=%5.2Vz repr= 123zrepr=12z repr= 12Z010s%03irnZ0010s%0.4iz-123s%iis%lis%llis%zis%ds%lds%llds%zdrs%urs%lus%llus%zurmrrks%prlrs%010irys%100is%.100iPs%100.80is%010us%100us%.100us%100.80us%010xi#s%100xs%.100xs%100.80xz%A:'abc\xe9\uabcd\U0010ffff's%%A:%Au abcéꯍ􏿿zrepr=abcsrepr=%Vsxyzu repr=人民s人民u repr=abc�sabcs%1%sz%1abcs%1abcz%+is%+iz%.%ss%.%srPrs%s)r import_modulerrrrrr r r r r rrrrr%argtypesZrestyperrr2rrrr~)r"rrrr r r r r rrrrrrZ min_longlongZ max_longlongZ max_ulonglongr)rrrr"r test_from_format s <  ,            zCAPITest.test_from_formatc Cs:ddlm}tdddlm}m}|dd\}}||d||d|dd \}}||d ||d|dd \}}||d ||d |dd \}}||d ||d |d d\}}||d||dtd}||dkrd }d}nd}d}|||\}}||||||ddS)Nr)unicode_aswidecharrc_wcharrrrmrrr8rgrrtrnabcdefrrabcdefrrkrs) r2r rrrr"rr&r[) r"r r"rwcharrnonbmpbuflenncharrrr test_aswidechar s6             zCAPITest.test_aswidecharcCsddlm}tdddlm}m}|d\}}||d||d|d\}}||d ||d td }||d krd }nd }||\}}||||||ddS)Nr)unicode_aswidecharstringrr!r8rgrtr#rr$rrmrkrs) r2r*rrrr"rr&r[)r"r*r"rr%rr&r(rrr test_aswidecharstring s            zCAPITest.test_aswidecharstringcCsddlm}dD]}t|}||||d|d||||d|d||||dd|d ||||dd|d |t|||dd|t|||d dd||g}|||t|d|d|||t|d|dqdS) Nr)unicode_asucs4)r8u¡¢u你好ua😀 abcuTrsFr/rku￿rm)r2r,rr&r2 SystemErrorrY)r"r,rBlrrr test_asucs4 s zCAPITest.test_asucs4cCs^ddlm}d}d}td}|||d|||d|||d|t|d dS) Nr)unicode_asutf8rur/rĀr6r7r-)r2r1r[r&r2UnicodeEncodeError)r"r1rrr&rrr test_asutf8 s zCAPITest.test_asutf8cCs^ddlm}d}d}td}|||d|||d|||d|t|d dS) Nr)unicode_asutf8andsizerur/r)r2rm)r6rg)r7rr-)r2r5r[r&r2r3)r"r5rrr&rrr test_asutf8andsize, s zCAPITest.test_asutf8andsizec Cspddlm}dD]V}t|D]H\}}|||t|dt|d||||t|dt|d|qqd}|||ddt|dd|||ddt|dd|||tddt|ddd |||tddt|ddd |||tddddd|||tdt|ddd|||tdt| ddd|||tdt| ddddS) Nr)unicode_findchar)¡u耀肀ru🄀🇱rkrlz!>_r&r2r3rr)r"r>rrr test_encode_decimal{ s$    zCAPITest.test_encode_decimalcCsPddlm}||dd||dd||dd||dddS)Nr)unicode_transformdecimaltoasciirr?z3.14r@rA)r2rCr&)r"Ztransform_decimalrrr test_transform_decimal s     zCAPITest.test_transform_decimalcCsxddlm}dD]b}d}tdD]P}|t|7}|||t||d|||t||dq qdS)Nr)getargs_s_hash)ri i rPrrk)r2rEr\r[r&r)r"rEkrBrrrr test_pep393_utf8_caching_bug s    z%CAPITest.test_pep393_utf8_caching_bugN)rrrrrrr)r+r0r4r6r9r=rBrDrHrrrr r s,r %      )  rc@seZdZddZddZdS)StringModuleTestcCsdd}|d}||gd|d}||ddg|d}||d g|d }||g|d }||d g|ttjd dS)NcSstt|Sr)rx_stringformatter_parserrrrr parse sz5StringModuleTest.test_formatter_parser..parsez2prefix {2!s}xxx{0:^+10.3f}{obj.attr!s} {z[0]!s:10}))prefix rrPrB)rrz^+10.3fN)rPzobj.attrrPrB)r1zz[0]rrBzprefix {} suffix)rMrPrPN)z suffixNNNr)rNNNrPr)rPrrPNrk)r&r2r]rJrK)r"rL formatterrrr test_formatter_parser s& z&StringModuleTest.test_formatter_parsercCstdd}||ddgg||dddgg||dddgg||ddgd g|ttjd dS) NcSs"tt|}t|d|d<|S)Nrk)rxrJformatter_field_name_split)ritemsrrr r sz?StringModuleTest.test_formatter_field_name_split..splitr!zobj.argTrzobj[key])Frzobj.arg[key1][key2])rR)FZkey1)FZkey2rk)r&r2r]rJrP)r"rrrr test_formatter_field_name_split s z0StringModuleTest.test_formatter_field_name_splitN)rrrrOrSrrrr rI s!rI__main__)__doc__rJcodecsrrrrUrr rrrrrZtest.support.script_helperrrregisterrrrrvrZMixinStrUnicodeTestZTestCaserrrIrmainrrrr s^   :P3