o Ec@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_encodeIncrementalDecoderIncrementalEncoderUTF8cOs4z ||i|Wn |yYdSwtd|)NzDid not raise %s.)AssertionError) exceptionZfunctionargskwargsrQ/opt/alt/python310/lib/python3.10/site-packages/pip/_vendor/webencodings/tests.py assert_raisess   rcCs tdjdks JtdjdksJtdjdksJtdjdks$Jtdjdks-Jtdjdks6Jtdjdks?JtddusGJtddusOJtd jd ksXJtd jd ksaJtd jd ksjJtd jd kssJtddus{JtddusJdS)Nzutf-8zUtf-8zUTF-8utf8zutf8 z utf8 u8uutf-8 zUS-ASCIIz windows-1252z iso-8859-1latin1ZLATIN1zlatin-1uLATİN1)rnamerrrr test_labelssrcCstD]m}td|dt|fksJtd|dksJdD]"}tdg||\}}t|gks0Jttdg||gks>Jqt|}|ddksLJ|jddddksWJt|}|ddksdJ|jddddksoJqt t D] }t|j |ksJqvdS)N)rr T)final) rrrrrlistr r r setvaluesr)Zlabelrepeatoutput_decoderencoderrrrrtest_all_labels0s r%cCsTtttddtttddtttgdtttgdtttdtttddS)NéZinvalidé)r LookupErrorrrrr r r rrrrtest_invalid_labelCs  r)cCstdddtdfks JtdtddtdfksJtdddtdfks)Jtdtdtdfks6JtdddtdfksCJtd ddtdfksPJtd ddtd fks]Jtd ddtd fksjJtdddtd fkswJtdddtd fksJtdddtd fksJtdddtd fksJtdddtd fksJtdddtd fksJtdddtd fksJtdddtd fksJdS)Nru€érr'asciiér&utf-16beutf-16lesuszUTF-16BEzUTF-16LEzUTF-16)rrr rrrr test_decodeLs r4cCsptdddks JtdddksJtdddksJtdddks$Jtdddks-Jtdd d ks6JdS) Nr'rrr+utf-16r3r1r/r2)rrrrr test_encodebs r7cCsldd}|gddks J|dgddksJ|dgddks!J|dgdd ks+J|d d gdd ks6J|d d gdd ksAJ|dgddksKJ|dgddksUJ|gdddks`J|gdddkskJ|gdddksvJ|dgddksJ|dgddksJ|dgddksJ|dgddksJ|gdddksJ|gdddksJdS)NcSst||\}}d|S)Nr)rjoin)inputZfallback_encodingr!Z _encodingrrriter_decode_to_stringls z/test_iter_decode..iter_decode_to_stringrrrr5r'shelloZhelloshelloshellor+r-r&))r=ar>ua�)rrrsr?r=suï»r.r0)rrrs)rshr;x-user-defineduhllor)r:rrrtest_iter_decodeksL rEcCsdtgddks JdtdgddksJdtdgddks&Jdtgdddks4JdtgdddksBJdtgdd dksPJdtgdd d ks^Jdtgd d dkslJdS)Nrrrr'r5)rr'rrr6r3r1r/r2)ruhrZllorDshllo)r8r rrrrtest_iter_encodes  rFcCs@d}d}d}d}t|d|tdfksJt|d|ksJdS)Ns2, O#ɻtϨu2, O#tsaaZaarD)rrr)ZencodedZdecodedrrrtest_x_user_defineds rGN)__doc__Z __future__rrrrrrrr r r r rrr%r)r4r7rErFrGrrrrs ,