1818 ':pass@' ,
1919 'u:p@h' ,
2020 'u:p@h:1' ,
21+ 'postgres://host/database' ,
2122 'pq://user:password@host:port/database?setting=value#public,private' ,
2223 'pq://fæm.com:123/õéf/á?param=val' ,
2324 'pq://l»»@fæm.com:123/õéf/á?param=val' ,
8485]
8586
8687class test_iri (unittest .TestCase ):
88+ def testAlternateSchemes (self ):
89+ field = pg_iri .parse ("postgres://host" )['host' ]
90+ self .assertEqual (field , 'host' )
91+
92+ field = pg_iri .parse ("postgresql://host" )['host' ]
93+ self .assertEqual (field , 'host' )
94+
95+ try :
96+ pg_iri .parse ("reject://host" )
97+ except ValueError :
98+ pass
99+ else :
100+ self .fail ("unacceptable IRI scheme not rejected" )
101+
87102 def testIP6Hosts (self ):
88103 """
89104 Validate that IPv6 hosts are properly extracted.
@@ -101,15 +116,19 @@ def testIP6Hosts(self):
101116 self .assertEqual (p ['host' ], h )
102117
103118 def testPresentPasswordObscure (self ):
104- "password is present in IRI, and obscure it"
119+ """
120+ Password is present in IRI, and obscure it.
121+ """
105122 s = 'pq://user:pass@host:port/dbname'
106123 o = 'pq://user:***@host:port/dbname'
107124 p = pg_iri .parse (s )
108125 ps = pg_iri .serialize (p , obscure_password = True )
109126 self .assertEqual (ps , o )
110127
111128 def testPresentPasswordObscure (self ):
112- "password is *not* present in IRI, and do nothing"
129+ """
130+ Password is *not* present in IRI, and do nothing.
131+ """
113132 s = 'pq://user@host:port/dbname'
114133 o = 'pq://user@host:port/dbname'
115134 p = pg_iri .parse (s )
0 commit comments