U .e@sdZddlmZddlmZmZmZmZmZm Z m Z m Z m Z ddZ ddZd d Zd d Zd dZddZddZddZddZdS)z webencodings.tests ~~~~~~~~~~~~~~~~~~ A basic test suite for Encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literals) lookupLABELSdecodeencode iter_decode iter_encodeIncrementalDecoderIncrementalEncoderUTF8cOs6z|||Wn|k r$YdSXtd|dS)NzDid not raise %s.AssertionError)Z exceptionZfunctionargskwargsrB/usr/lib/python3.8/site-packages/pip/_vendor/webencodings/tests.py assert_raisess rcCs tdjdksttdjdks$ttdjdks6ttdjdksHttdjdksZttdjdkslttdjdks~ttddksttddksttd jd ksttd jd ksttd jd ksttd jd ksttddksttddkstdS)Nzutf-8zUtf-8zUTF-8utf8zutf8 z utf8 u8uutf-8 zUS-ASCIIz windows-1252z iso-8859-1latin1ZLATIN1zlatin-1uLATİN1)rnamerrrrr test_labelssrcCstD]}td|dt|fks"ttd|dks4tdD]D}tdg||\}}t|gks`tttdg||gks8tq8t|}|ddkst|jddddkstt |}|ddkst|jddddkstqt t D]}t|j |kstqdS)N)rr T)final) rrrrrrlistr r r setvaluesr)Zlabelrepeatoutput_decoderencoderrrrrtest_all_labels0sr%cCsTtttddtttddtttgdtttgdtttdtttddS)NéZinvalidé)r LookupErrorrrrr r r rrrrtest_invalid_labelCs  r)cCstdddtdfksttdtddtdfks8ttdddtdfksRttdtdtdfkslttdddtdfksttd ddtdfksttd ddtd fksttd ddtd fksttdddtd fksttdddtd fks ttdddtd fks&ttdddtd fksBttdddtd fks^ttdddtd fkszttdddtd fksttdddtd fkstdS)Nru€érr'asciiér&utf-16beutf-16lesuszUTF-16BEzUTF-16LEzUTF-16)rrrr rrrr test_decodeLs r4cCsptdddksttdddks$ttdddks6ttdddksHttdddksZttdd d ksltdS) Nr'rrr+utf-16r3r1r/r2)rrrrrr test_encodebs r7cCsdd}|gddkst|dgddks.t|dgddksBt|dgdd ksVt|d d gdd kslt|d d gdd kst|dgddkst|dgddkst|dddgddkst|dddgddkst|ddddddgddkst|dgddkst|dgddks$t|dgddks:t|dgddksPt|ddddddgddkspt|ddd gd d!kstdS)"NcSst||\}}d|S)Nr)rjoin)inputZfallback_encodingr!Z _encodingrrriter_decode_to_stringlsz/test_iter_decode..iter_decode_to_stringrrrr5r'shelloZhellosheslloshellor+r-r&saua�ssuï»r.r0sshx-user-defineduhllor )r:rrrtest_iter_decodeks rCcCsdtgddkstdtdgddks2tdtdgddksLtdtddddgddksltdtddddgddkstdtddddgddkstdtddddgd d kstdtdd dd gd dkstdS)Nrrrr'r5r6r3r1r/r2uhZllorBshllo)r8r rrrrrtest_iter_encodes"    rDcCs@d}d}d}d}t|d|tdfks*tt|d|kss ,