22from unittest import mock
33
44import pytest
5- from sqlalchemy .engine import make_url
6- from sqlalchemy .engine .url import URL
5+ from sqlalchemy .engine .url import make_url , URL
76
87from trino .auth import BasicAuthentication
98from trino .dbapi import Connection
@@ -24,7 +23,7 @@ def setup(self):
2423 user = "user" ,
2524 host = "localhost" ,
2625 )),
27- 'trino://user@localhost:8080?source=trino-sqlalchemy' ,
26+ 'trino://user@localhost:8080/ ?source=trino-sqlalchemy' ,
2827 list (),
2928 dict (host = "localhost" , catalog = "system" , user = "user" , port = 8080 , source = "trino-sqlalchemy" ),
3029 ),
@@ -34,7 +33,7 @@ def setup(self):
3433 host = "localhost" ,
3534 port = 443 ,
3635 )),
37- 'trino://user@localhost:443?source=trino-sqlalchemy' ,
36+ 'trino://user@localhost:443/ ?source=trino-sqlalchemy' ,
3837 list (),
3938 dict (host = "localhost" , port = 443 , catalog = "system" , user = "user" , source = "trino-sqlalchemy" ),
4039 ),
@@ -45,7 +44,7 @@ def setup(self):
4544 host = "localhost" ,
4645 source = "trino-rulez" ,
4746 )),
48- 'trino://user:***@localhost:8080?source=trino-rulez' ,
47+ 'trino://user:***@localhost:8080/ ?source=trino-rulez' ,
4948 list (),
5049 dict (
5150 host = "localhost" ,
@@ -64,7 +63,7 @@ def setup(self):
6463 cert = "/my/path/to/cert" ,
6564 key = "afdlsdfk%4#'" ,
6665 )),
67- 'trino://user@localhost:8080'
66+ 'trino://user@localhost:8080/ '
6867 '?cert=%2Fmy%2Fpath%2Fto%2Fcert'
6968 '&key=afdlsdfk%254%23%27'
7069 '&source=trino-sqlalchemy' ,
@@ -85,7 +84,7 @@ def setup(self):
8584 host = "localhost" ,
8685 access_token = "afdlsdfk%4#'" ,
8786 )),
88- 'trino://user@localhost:8080'
87+ 'trino://user@localhost:8080/ '
8988 '?access_token=afdlsdfk%254%23%27'
9089 '&source=trino-sqlalchemy' ,
9190 list (),
@@ -109,7 +108,7 @@ def setup(self):
109108 client_tags = ["1" , "sql" ],
110109 experimental_python_types = True ,
111110 )),
112- 'trino://user@localhost:8080'
111+ 'trino://user@localhost:8080/ '
113112 '?client_tags=%5B%221%22%2C+%22sql%22%5D'
114113 '&experimental_python_types=true'
115114 '&extra_credential=%5B%5B%22a%22%2C+%22b%22%5D%2C+%5B%22c%22%2C+%22d%22%5D%5D'
@@ -145,7 +144,7 @@ def setup(self):
145144 client_tags = ["1 @& /\" " , "sql" ],
146145 verify = False ,
147146 )),
148- 'trino://user%40test.org%2Fmy_role:***@localhost:8080'
147+ 'trino://user%40test.org%2Fmy_role:***@localhost:8080/ '
149148 '?client_tags=%5B%221+%40%26+%2F%5C%22%22%2C+%22sql%22%5D'
150149 '&experimental_python_types=true'
151150 '&extra_credential=%5B%5B%22user1%40test.org%2Fmy_role%22%2C+'
@@ -184,7 +183,7 @@ def setup(self):
184183 "system" : "analyst" ,
185184 }
186185 )),
187- 'trino://user@localhost:8080'
186+ 'trino://user@localhost:8080/ '
188187 '?roles=%7B%22hive%22%3A+%22finance%22%2C+%22system%22%3A+%22analyst%22%7D&source=trino-sqlalchemy' ,
189188 list (),
190189 dict (
@@ -196,14 +195,14 @@ def setup(self):
196195 source = "trino-sqlalchemy" ,
197196 ),
198197 ),
199- ],
198+ ]
200199 )
201200 def test_create_connect_args (
202- self ,
203- url : URL ,
204- generated_url : str ,
205- expected_args : List [Any ],
206- expected_kwargs : Dict [str , Any ]
201+ self ,
202+ url : URL ,
203+ generated_url : str ,
204+ expected_args : List [Any ],
205+ expected_kwargs : Dict [str , Any ]
207206 ):
208207 assert repr (url ) == generated_url
209208
0 commit comments