<s> __author__ = '<STR_LIT>' <EOL> import unittest <EOL> import atom . url <EOL> import gdata . test_config as conf <EOL> class UrlTest ( unittest . TestCase ) : <EOL> def testParseUrl ( self ) : <EOL> url = atom . url . parse_url ( '<STR_LIT>' ) <EOL> self . assert_ ( url . protocol == '<STR_LIT:http>' ) <EOL> self . assertTrue ( url . port is None ) <EOL> self . assert_ ( url . host == '<STR_LIT>' ) <EOL> self . assert_ ( url . path == '<STR_LIT>' ) <EOL> self . assert_ ( url . params == { } ) <EOL> url = atom . url . parse_url ( '<STR_LIT>' ) <EOL> self . assert_ ( url . protocol == '<STR_LIT:http>' ) <EOL> self . assert_ ( url . host == '<STR_LIT>' ) <EOL> self . assert_ ( url . port == '<STR_LIT>' ) <EOL> self . assert_ ( url . path == '<STR_LIT>' ) <EOL> self . assert_ ( url . params == { } ) <EOL> url = atom . url . parse_url ( '<STR_LIT>' ) <EOL> self . assert_ ( url . protocol is None ) <EOL> self . assert_ ( url . host is None ) <EOL> self . assert_ ( url . path == '<STR_LIT>' ) <EOL> self . assert_ ( len ( url . params . keys ( ) ) == <NUM_LIT:1> ) <EOL> self . assert_ ( '<STR_LIT:foo>' in url . params ) <EOL> self . assert_ ( url . params [ '<STR_LIT:foo>' ] == '<STR_LIT:bar>' ) <EOL> url = atom . url . parse_url ( '<STR_LIT>' ) <EOL> self . assert_ ( len ( url . params . keys ( ) ) == <NUM_LIT:1> ) <EOL> self . assert_ ( '<STR_LIT>' in url . params ) <EOL> self . assert_ ( url . params [ '<STR_LIT>' ] == '<STR_LIT>' ) <EOL> def testUrlToString ( self ) : <EOL> url = atom . url . Url ( port = <NUM_LIT> ) <EOL> url . host = '<STR_LIT>' <EOL> self . assert_ ( str ( url ) , '<STR_LIT>' ) <EOL> url = atom . url . Url ( protocol = '<STR_LIT:http>' , host = '<STR_LIT>' , path = '<STR_LIT>' ) <EOL> url . params [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . assert_ ( url . to_string ( ) == ( <EOL> '<STR_LIT>' ) ) <EOL> def testGetRequestUri ( self ) : <EOL> url = atom . url . Url ( protocol = '<STR_LIT:http>' , host = '<STR_LIT>' , path = '<STR_LIT>' ) <EOL> url . params [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . assert_ ( url . get_request_uri ( ) == ( <EOL> '<STR_LIT>' ) ) <EOL> self . assert_ ( url . get_param_string ( ) == ( <EOL> '<STR_LIT>' ) ) <EOL> def testComparistons ( self ) : <EOL> url1 = atom . url . Url ( protocol = '<STR_LIT:http>' , host = '<STR_LIT>' , path = '<STR_LIT>' , <EOL> params = { '<STR_LIT:x>' : '<STR_LIT:1>' , '<STR_LIT:y>' : '<STR_LIT:2>' } ) <EOL> url2 = atom . url . Url ( host = '<STR_LIT>' , port = <NUM_LIT> , path = '<STR_LIT>' , <EOL> params = { '<STR_LIT:y>' : '<STR_LIT:2>' , '<STR_LIT:x>' : '<STR_LIT:1>' } ) <EOL> self . assertEquals ( url1 , url2 ) <EOL> url3 = atom . url . Url ( host = '<STR_LIT>' , port = <NUM_LIT> , path = '<STR_LIT>' , <EOL> params = { '<STR_LIT:x>' : '<STR_LIT:1>' , '<STR_LIT:y>' : '<STR_LIT:2>' } ) <EOL> self . assert_ ( url1 != url3 ) <EOL> self . assert_ ( url2 != url3 ) <EOL> url4 = atom . url . Url ( protocol = '<STR_LIT>' , host = '<STR_LIT>' , path = '<STR_LIT>' , <EOL> params = { '<STR_LIT:x>' : '<STR_LIT:1>' , '<STR_LIT:y>' : '<STR_LIT:2>' } ) <EOL> self . assert_ ( url1 != url4 ) <EOL> self . assert_ ( url2 != url4 ) <EOL> self . assert_ ( url3 != url4 ) <EOL> def suite ( ) : <EOL> return conf . build_suite ( [ UrlTest ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
