ó
|ûzJc           @   so   d  Z  e Z d g Z d d l Z d d l m Z m Z m Z m	 Z	 m
 Z
 d e j f d „  ƒ  YZ d „  Z d S(   s   Unit tests.t
   test_suiteiÿÿÿÿN(   t   InvalidURIErrort   URIt   find_uris_in_textt   merget   remove_dot_segmentst   URITestCasec           B   sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s¬   |  j  t t d ƒ ƒ d ƒ |  j  t t d ƒ ƒ d ƒ |  j  t t d ƒ ƒ d ƒ |  j  t t d ƒ ƒ d ƒ |  j  t t d	 ƒ ƒ d ƒ |  j  t t d
 ƒ ƒ d ƒ d  S(   Ns"   eXAMPLE://a/./b/../b/%63/%7bfoo%7ds   example://a/b/c/%7Bfoo%7Ds   http://www.EXAMPLE.com/s   http://www.example.com/s   http://www.gnome.org/%7ejamesh/s   http://www.gnome.org/~jamesh/s   http://example.coms   http://example.com/s   http://example.com:/s   http://example.com:80/(   t   assertEqualt   strR   (   t   self(    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt   test_normalisation   s    c         C   s€   |  j  t d d d t ƒd ƒ |  j  t d d d t ƒd ƒ |  j  t d d d t ƒd ƒ |  j  t d d d t ƒd ƒ d  S(   Nt    t   foot   has_authoritys   /foos   /a/b/cs   /a/b/foos   /a/b/(   R   R   t   Truet   False(   R	   (    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt
   test_merge2   s    c         C   s0   |  j  t d ƒ d ƒ |  j  t d ƒ d ƒ d  S(   Ns   /a/b/c/./../../gs   /a/gs   mid/content=5/../6s   mid/6(   R   R   (   R	   (    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt   test_remove_dot_segments<   s    c            s  t  d ƒ ‰  ‡  f d †  } |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d	 ƒ d
 ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d  ƒ d ƒ |  j | d! ƒ d" ƒ |  j | d# ƒ d" ƒ |  j | d$ ƒ d% ƒ |  j | d& ƒ d' ƒ |  j | d( ƒ d' ƒ |  j | d) ƒ d
 ƒ d  S(*   Ns   http://a/b/c/d;p?qc            s   t  ˆ  j |  ƒ ƒ S(   N(   R   t   resolve(   t   relative(   t   base(    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyR   D   s    s   g:ht   gs   http://a/b/c/gs   ./gs   g/s   http://a/b/c/g/s   /gs
   http://a/gs   //gs	   http://g/s   ?ys   http://a/b/c/d;p?ys   g?ys   http://a/b/c/g?ys   #ss   http://a/b/c/d;p?q#ss   g#ss   http://a/b/c/g#ss   g?y#ss   http://a/b/c/g?y#ss   ;xs   http://a/b/c/;xs   g;xs   http://a/b/c/g;xs   g;x?y#ss   http://a/b/c/g;x?y#sR   t   .s   http://a/b/c/s   ./s   ..s   http://a/b/s   ../s   ../gs   http://a/b/gs   ../..s	   http://a/s   ../../s   ../../g(   R   R   (   R	   R   (    (   R   s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt   test_normal_resolutionA   s2    c            s«  t  d ƒ ‰  ‡  f d †  } |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d	 ƒ |  j | d
 ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d ƒ d ƒ |  j | d  ƒ d! ƒ |  j | d" ƒ d# ƒ d  S($   Ns   http://a/b/c/d;p?qc            s   t  ˆ  j |  ƒ ƒ S(   N(   R   R   (   R   (   R   (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyR   b   s    s
   ../../../gs
   http://a/gs   ../../../../gs   /./gs   /../gs   g.s   http://a/b/c/g.s   .gs   http://a/b/c/.gs   g..s   http://a/b/c/g..s   ..gs   http://a/b/c/..gs   ./../gs   http://a/b/gs   ./g/.s   http://a/b/c/g/s   g/./hs   http://a/b/c/g/hs   g/../hs   http://a/b/c/hs	   g;x=1/./ys   http://a/b/c/g;x=1/ys
   g;x=1/../ys   http://a/b/c/ys   g?y/./xs   http://a/b/c/g?y/./xs   g?y/../xs   http://a/b/c/g?y/../xs   g#s/./xs   http://a/b/c/g#s/./xs   g#s/../xs   http://a/b/c/g#s/../x(   R   R   (   R	   R   (    (   R   s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt   test_abnormal_resolution_   s(    c         C   sR   t  d ƒ } |  j | j d ƒ ƒ |  j | j d ƒ ƒ |  j | j d ƒ ƒ d  S(   Ns   http://code.launchpad.dev/foos   code.launchpad.devs   launchpad.devR   (   R   t
   assertTruet   underDomain(   R	   t   uri(    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt"   test_underDomain_matches_subdomain{   s    c         C   sR   t  d ƒ } |  j | j d ƒ ƒ |  j | j d ƒ ƒ |  j | j d ƒ ƒ d  S(   Ns   http://code.launchpad.dev/foos   beta.code.launchpad.devs
   google.coms   unchpad.dev(   R   t   assertFalseR   (   R	   R   (    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt+   test_underDomain_doesnt_match_non_subdomainƒ   s    (	   t   __name__t
   __module__R
   R   R   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyR      s   		
				c           C   s   t  j ƒ  j t ƒ S(   N(   t   unittestt
   TestLoadert   loadTestsFromNameR   (    (    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt   additional_testsŒ   s    (   t   __doc__t   typet   __metaclass__t   __all__R!   t   lazr.uriR   R   R   R   R   t   TestCaseR   R$   (    (    (    s;   /usr/lib/python2.7/dist-packages/lazr/uri/tests/test_uri.pyt   <module>   s   	(o