2
2
from unittest import mock
3
3
4
4
import pytest
5
- from sqlalchemy .engine import make_url
6
- from sqlalchemy .engine .url import URL
5
+ from sqlalchemy .engine .url import make_url , URL
7
6
8
7
from trino .auth import BasicAuthentication
9
8
from trino .dbapi import Connection
@@ -24,7 +23,7 @@ def setup(self):
24
23
user = "user" ,
25
24
host = "localhost" ,
26
25
)),
27
- 'trino://user@localhost:8080?source=trino-sqlalchemy' ,
26
+ 'trino://user@localhost:8080/ ?source=trino-sqlalchemy' ,
28
27
list (),
29
28
dict (host = "localhost" , catalog = "system" , user = "user" , port = 8080 , source = "trino-sqlalchemy" ),
30
29
),
@@ -34,7 +33,7 @@ def setup(self):
34
33
host = "localhost" ,
35
34
port = 443 ,
36
35
)),
37
- 'trino://user@localhost:443?source=trino-sqlalchemy' ,
36
+ 'trino://user@localhost:443/ ?source=trino-sqlalchemy' ,
38
37
list (),
39
38
dict (host = "localhost" , port = 443 , catalog = "system" , user = "user" , source = "trino-sqlalchemy" ),
40
39
),
@@ -45,7 +44,7 @@ def setup(self):
45
44
host = "localhost" ,
46
45
source = "trino-rulez" ,
47
46
)),
48
- 'trino://user:***@localhost:8080?source=trino-rulez' ,
47
+ 'trino://user:***@localhost:8080/ ?source=trino-rulez' ,
49
48
list (),
50
49
dict (
51
50
host = "localhost" ,
@@ -64,7 +63,7 @@ def setup(self):
64
63
cert = "/my/path/to/cert" ,
65
64
key = "afdlsdfk%4#'" ,
66
65
)),
67
- 'trino://user@localhost:8080'
66
+ 'trino://user@localhost:8080/ '
68
67
'?cert=%2Fmy%2Fpath%2Fto%2Fcert'
69
68
'&key=afdlsdfk%254%23%27'
70
69
'&source=trino-sqlalchemy' ,
@@ -85,7 +84,7 @@ def setup(self):
85
84
host = "localhost" ,
86
85
access_token = "afdlsdfk%4#'" ,
87
86
)),
88
- 'trino://user@localhost:8080'
87
+ 'trino://user@localhost:8080/ '
89
88
'?access_token=afdlsdfk%254%23%27'
90
89
'&source=trino-sqlalchemy' ,
91
90
list (),
@@ -109,7 +108,7 @@ def setup(self):
109
108
client_tags = ["1" , "sql" ],
110
109
experimental_python_types = True ,
111
110
)),
112
- 'trino://user@localhost:8080'
111
+ 'trino://user@localhost:8080/ '
113
112
'?client_tags=%5B%221%22%2C+%22sql%22%5D'
114
113
'&experimental_python_types=true'
115
114
'&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):
145
144
client_tags = ["1 @& /\" " , "sql" ],
146
145
verify = False ,
147
146
)),
148
- 'trino://user%40test.org%2Fmy_role:***@localhost:8080'
147
+ 'trino://user%40test.org%2Fmy_role:***@localhost:8080/ '
149
148
'?client_tags=%5B%221+%40%26+%2F%5C%22%22%2C+%22sql%22%5D'
150
149
'&experimental_python_types=true'
151
150
'&extra_credential=%5B%5B%22user1%40test.org%2Fmy_role%22%2C+'
@@ -184,7 +183,7 @@ def setup(self):
184
183
"system" : "analyst" ,
185
184
}
186
185
)),
187
- 'trino://user@localhost:8080'
186
+ 'trino://user@localhost:8080/ '
188
187
'?roles=%7B%22hive%22%3A+%22finance%22%2C+%22system%22%3A+%22analyst%22%7D&source=trino-sqlalchemy' ,
189
188
list (),
190
189
dict (
@@ -196,14 +195,14 @@ def setup(self):
196
195
source = "trino-sqlalchemy" ,
197
196
),
198
197
),
199
- ],
198
+ ]
200
199
)
201
200
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 ]
207
206
):
208
207
assert repr (url ) == generated_url
209
208
0 commit comments