<s> """<STR_LIT>""" <EOL> import copy <EOL> import sys <EOL> import warnings <EOL> sys . path [ <NUM_LIT:0> : <NUM_LIT:0> ] = [ "<STR_LIT>" ] <EOL> from pymongo . uri_parser import ( _partition , <EOL> _rpartition , <EOL> parse_userinfo , <EOL> split_hosts , <EOL> split_options , <EOL> parse_uri ) <EOL> from pymongo . errors import ConfigurationError , InvalidURI <EOL> from pymongo import ReadPreference <EOL> from bson . binary import JAVA_LEGACY <EOL> from bson . py3compat import string_type , _unicode <EOL> from test import unittest <EOL> class TestURI ( unittest . TestCase ) : <EOL> def test_partition ( self ) : <EOL> self . assertEqual ( ( '<STR_LIT:foo>' , '<STR_LIT::>' , '<STR_LIT:bar>' ) , _partition ( '<STR_LIT>' , '<STR_LIT::>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , _partition ( '<STR_LIT>' , '<STR_LIT::>' ) ) <EOL> def test_rpartition ( self ) : <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT::>' , '<STR_LIT:bar>' ) , _rpartition ( '<STR_LIT>' , '<STR_LIT::>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , _rpartition ( '<STR_LIT>' , '<STR_LIT::>' ) ) <EOL> def test_validate_userinfo ( self ) : <EOL> self . assertRaises ( InvalidURI , parse_userinfo , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( InvalidURI , parse_userinfo , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( InvalidURI , parse_userinfo , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( InvalidURI , parse_userinfo , '<STR_LIT::>' ) <EOL> self . assertTrue ( parse_userinfo ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> parse_userinfo ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> parse_userinfo ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> parse_userinfo ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> parse_userinfo ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> parse_userinfo ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> parse_userinfo ( '<STR_LIT>' ) ) <EOL> def test_split_hosts ( self ) : <EOL> self . assertRaises ( ConfigurationError , split_hosts , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( ConfigurationError , split_hosts , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( ConfigurationError , split_hosts , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( [ ( '<STR_LIT:localhost>' , <NUM_LIT> ) , ( '<STR_LIT>' , <NUM_LIT> ) ] , <EOL> split_hosts ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( [ ( '<STR_LIT:localhost>' , <NUM_LIT> ) , ( '<STR_LIT>' , <NUM_LIT> ) ] , <EOL> split_hosts ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( [ ( '<STR_LIT>' , None ) ] , <EOL> split_hosts ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( [ ( '<STR_LIT>' , None ) , <EOL> ( '<STR_LIT>' , <NUM_LIT> ) ] , <EOL> split_hosts ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> self . assertEqual ( [ ( '<STR_LIT>' , <NUM_LIT> ) , <EOL> ( '<STR_LIT>' , None ) ] , <EOL> split_hosts ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> self . assertRaises ( ValueError , split_hosts , '<STR_LIT>' , <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , split_hosts , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_hosts , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_hosts , '<STR_LIT>' ) <EOL> self . assertEqual ( [ ( '<STR_LIT>' , <NUM_LIT> ) ] , split_hosts ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( [ ( '<STR_LIT>' , <NUM_LIT> ) ] , split_hosts ( '<STR_LIT>' ) ) <EOL> def test_split_options ( self ) : <EOL> self . assertRaises ( ConfigurationError , split_options , '<STR_LIT:foo>' ) <EOL> self . assertRaises ( ConfigurationError , split_options , '<STR_LIT>' ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> with warnings . catch_warnings ( ) : <EOL> warnings . filterwarnings ( '<STR_LIT:error>' ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> if not ( sys . platform == "<STR_LIT:win32>" and sys . version_info <= ( <NUM_LIT:2> , <NUM_LIT:5> ) ) : <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , <EOL> '<STR_LIT>' , warn = True ) <EOL> self . assertRaises ( Warning , split_options , '<STR_LIT>' , <EOL> warn = True ) <EOL> self . assertRaises ( Warning , split_options , '<STR_LIT>' , <EOL> warn = True ) <EOL> self . assertRaises ( Warning , split_options , '<STR_LIT>' , <EOL> warn = True ) <EOL> self . assertRaises ( Warning , split_options , '<STR_LIT>' , <EOL> warn = True ) <EOL> self . assertRaises ( Warning , <EOL> split_options , '<STR_LIT>' , <EOL> warn = True ) <EOL> self . assertRaises ( ConfigurationError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> if not ( sys . platform == "<STR_LIT:win32>" and sys . version_info <= ( <NUM_LIT:2> , <NUM_LIT:5> ) ) : <EOL> self . assertRaises ( ValueError , split_options , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , split_options , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , <EOL> split_options , '<STR_LIT>' ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : <NUM_LIT> } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : <NUM_LIT> } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : <NUM_LIT> } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : <NUM_LIT> } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( isinstance ( split_options ( '<STR_LIT>' ) [ '<STR_LIT:w>' ] , int ) ) <EOL> self . assertTrue ( isinstance ( split_options ( '<STR_LIT>' ) [ '<STR_LIT:w>' ] , string_type ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : True } , split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : False } , split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : '<STR_LIT>' } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : '<STR_LIT>' } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : '<STR_LIT>' } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : '<STR_LIT>' } , <EOL> split_options ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( { '<STR_LIT>' : <NUM_LIT:50> } , split_options ( '<STR_LIT>' ) ) <EOL> def test_parse_uri ( self ) : <EOL> self . assertRaises ( InvalidURI , parse_uri , "<STR_LIT>" ) <EOL> self . assertRaises ( InvalidURI , parse_uri , "<STR_LIT>" ) <EOL> self . assertRaises ( ValueError , <EOL> parse_uri , "<STR_LIT>" , <NUM_LIT> ) <EOL> orig = { <EOL> '<STR_LIT>' : [ ( "<STR_LIT:localhost>" , <NUM_LIT> ) ] , <EOL> '<STR_LIT:username>' : None , <EOL> '<STR_LIT:password>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : { } <EOL> } <EOL> res = copy . deepcopy ( orig ) <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" ) ) <EOL> res . update ( { '<STR_LIT:username>' : '<STR_LIT>' , '<STR_LIT:password>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" ) ) <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , <NUM_LIT> ) , ( "<STR_LIT>" , <NUM_LIT> ) ] <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT:localhost>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT:localhost>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT:localhost>" , <NUM_LIT> ) ] <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" ) ) <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res . update ( { '<STR_LIT:username>' : '<STR_LIT>' , '<STR_LIT:password>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , <NUM_LIT> ) , ( "<STR_LIT>" , <NUM_LIT> ) ] <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> self . assertRaises ( InvalidURI , parse_uri , <EOL> "<STR_LIT>" ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , None ) ] <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , None ) ] <EOL> res [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , None ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) ] <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , None ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) ] <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , <NUM_LIT> ) ] <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( "<STR_LIT>" , None ) ] <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = [ ( '<STR_LIT>' , None ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT:localhost>" , <NUM_LIT> ) ] <EOL> self . assertEqual ( res , parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> <NUM_LIT> ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res . update ( { '<STR_LIT:username>' : '<STR_LIT>' , '<STR_LIT:password>' : '<STR_LIT>' } ) <EOL> res . update ( { '<STR_LIT>' : '<STR_LIT:test>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : ReadPreference . SECONDARY . mode } <EOL> self . assertEqual ( res , parse_uri ( <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT:user>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:bar>' } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT:user>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT:user>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : ReadPreference . SECONDARY . mode , <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } ] } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : ReadPreference . SECONDARY . mode , <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> { } ] } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> res = copy . deepcopy ( orig ) <EOL> res [ '<STR_LIT>' ] = { '<STR_LIT>' : JAVA_LEGACY } <EOL> res [ '<STR_LIT:username>' ] = '<STR_LIT>' <EOL> res [ '<STR_LIT:password>' ] = '<STR_LIT:password>' <EOL> res [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . assertEqual ( res , <EOL> parse_uri ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> with warnings . catch_warnings ( ) : <EOL> warnings . filterwarnings ( '<STR_LIT:error>' ) <EOL> self . assertRaises ( Warning , parse_uri , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> warn = True ) <EOL> self . assertRaises ( ValueError , parse_uri , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_parse_uri_unicode ( self ) : <EOL> res = parse_uri ( _unicode ( "<STR_LIT>" ) ) <EOL> for key in res [ '<STR_LIT>' ] : <EOL> self . assertTrue ( isinstance ( key , str ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
