Current File : //lib/python2.7/site-packages/httplib2/iri2uri.pyc
�
�F	Vc@s�dZdZdZgZdZdZdZddlZd5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHgZd0�Z	d1�Z
ed2kr�ddlZd3ej
fd4��YZej�ndS(Is%
iri2uri

Converts an IRI to a URI.

s!Joe Gregorio (joe@bitworking.org)sCopyright 2006, Joe Gregorios1.0.0tMITt
i����Ni�i��i�i��i�i�i�i�ii��ii��ii��ii��ii��ii��ii��ii��i	i��	i
i��
ii��ii��i
i��
ii��ii��ii��cCs�|}t|�}xutD]m\}}||kr5Pn||kr||krdjg|jd�D]}dt|�^qc�}PqqW|S(Ntsutf-8s%%%2X(tordtescape_rangetjointencode(tctretvaltitlowthighto((s4/usr/lib/python2.7/site-packages/httplib2/iri2uri.pyR5s5cCs�t|t�r�tj|�\}}}}}|jd�}tj|||||f�}djg|D]}t|�^qg�}n|S(s�Convert an IRI to a URI. Note that IRIs must be
    passed in a unicode strings. That is, do not utf-8 encode
    the IRI before passing it into the function.tidnaR(t
isinstancetunicodeturlparseturlsplitRt
urlunsplitR(turitschemet	authoritytpathtquerytfragmentR((s4/usr/lib/python2.7/site-packages/httplib2/iri2uri.pytiri2uriAs+t__main__tTestcBseZd�Zd�ZRS(cCsIddddddddg}x$|D]}|j|t|��q%Wd	S(
s6Test that URIs are invariant under the transformation.u"ftp://ftp.is.co.za/rfc/rfc1808.txtu#http://www.ietf.org/rfc/rfc2396.txtu)ldap://[2001:db8::7]/c=GB?objectClass?oneumailto:John.Doe@example.comu&news:comp.infosystems.www.servers.unixutel:+1-816-555-1212utelnet://192.0.2.16:80/u3urn:oasis:names:specification:docbook:dtd:xml:4.1.2N(tassertEqualR(tselft	invariantR((s4/usr/lib/python2.7/site-packages/httplib2/iri2uri.pyt	test_urisTs	
cCs�|jdtd��|jdtd��|jdtd��|jdtd��|jd	td
��|jd	ttd
���|jd	td
jd���dS(
sG Test that the right type of escaping is done for each part of the URI.shttp://xn--o3h.com/%E2%98%84uhttp://☄.com/☄s%http://bitworking.org/?fred=%E2%98%84uhttp://bitworking.org/?fred=☄s http://bitworking.org/#%E2%98%84uhttp://bitworking.org/#☄s
#%E2%98%84u#☄s/fred?bar=%E2%98%9A#%E2%98%84u/fred?bar=☚#☄sutf-8N(RRtassertNotEqualR(R((s4/usr/lib/python2.7/site-packages/httplib2/iri2uri.pyttest_iribs(t__name__t
__module__RR!(((s4/usr/lib/python2.7/site-packages/httplib2/iri2uri.pyRRs	(i�i��(i�i��(i�i�(i�i�(ii��(ii��(ii��(ii��(ii��(ii��(ii��(ii��(i	i��	(i
i��
(ii��(ii��(i
i��
(ii��(ii��(ii��(t__doc__t
__author__t
__copyright__t__contributors__t__version__t__license__t__history__RRRRR"tunittesttTestCaseRtmain(((s4/usr/lib/python2.7/site-packages/httplib2/iri2uri.pyt<module>sB