This repository was archived by the owner on Aug 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +18
-28
lines changed Expand file tree Collapse file tree 4 files changed +18
-28
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,16 @@ def _get_connection_kwargs(self) -> dict:
26
26
options = self ._database_url .options
27
27
28
28
kwargs = {}
29
- min_size = options .get (' min_size' )
30
- max_size = options .get (' max_size' )
31
- ssl = options .get (' ssl' )
29
+ min_size = options .get (" min_size" )
30
+ max_size = options .get (" max_size" )
31
+ ssl = options .get (" ssl" )
32
32
33
33
if min_size is not None :
34
- kwargs [' minsize' ] = int (min_size )
34
+ kwargs [" minsize" ] = int (min_size )
35
35
if max_size is not None :
36
- kwargs [' maxsize' ] = int (max_size )
36
+ kwargs [" maxsize" ] = int (max_size )
37
37
if ssl is not None :
38
- kwargs [' ssl' ] = {' true' : True , ' false' : False }[ssl .lower ()]
38
+ kwargs [" ssl" ] = {" true" : True , " false" : False }[ssl .lower ()]
39
39
return kwargs
40
40
41
41
async def connect (self ) -> None :
@@ -48,7 +48,7 @@ async def connect(self) -> None:
48
48
password = self ._database_url .password ,
49
49
db = self ._database_url .database ,
50
50
autocommit = True ,
51
- ** kwargs
51
+ ** kwargs ,
52
52
)
53
53
54
54
async def disconnect (self ) -> None :
Original file line number Diff line number Diff line change @@ -37,16 +37,16 @@ def _get_connection_kwargs(self) -> dict:
37
37
options = self ._database_url .options
38
38
39
39
kwargs = {}
40
- min_size = options .get (' min_size' )
41
- max_size = options .get (' max_size' )
42
- ssl = options .get (' ssl' )
40
+ min_size = options .get (" min_size" )
41
+ max_size = options .get (" max_size" )
42
+ ssl = options .get (" ssl" )
43
43
44
44
if min_size is not None :
45
- kwargs [' min_size' ] = int (min_size )
45
+ kwargs [" min_size" ] = int (min_size )
46
46
if max_size is not None :
47
- kwargs [' max_size' ] = int (max_size )
47
+ kwargs [" max_size" ] = int (max_size )
48
48
if ssl is not None :
49
- kwargs [' ssl' ] = {' true' : True , ' false' : False }[ssl .lower ()]
49
+ kwargs [" ssl" ] = {" true" : True , " false" : False }[ssl .lower ()]
50
50
return kwargs
51
51
52
52
async def connect (self ) -> None :
Original file line number Diff line number Diff line change 3
3
import sys
4
4
import typing
5
5
from types import TracebackType
6
- from urllib .parse import SplitResult , urlsplit , parse_qsl
6
+ from urllib .parse import SplitResult , parse_qsl , urlsplit
7
7
8
8
from sqlalchemy .engine import RowProxy
9
9
from sqlalchemy .sql import ClauseElement
Original file line number Diff line number Diff line change 9
9
def test_postgres_pool_size ():
10
10
backend = PostgresBackend ("postgres://localhost/database?min_size=1&max_size=20" )
11
11
kwargs = backend ._get_connection_kwargs ()
12
- assert kwargs == {
13
- 'min_size' : 1 ,
14
- 'max_size' : 20
15
- }
12
+ assert kwargs == {"min_size" : 1 , "max_size" : 20 }
16
13
17
14
18
15
def test_postgres_ssl ():
19
16
backend = PostgresBackend ("postgres://localhost/database?ssl=true" )
20
17
kwargs = backend ._get_connection_kwargs ()
21
- assert kwargs == {
22
- 'ssl' : True ,
23
- }
18
+ assert kwargs == {"ssl" : True }
24
19
25
20
26
21
def test_mysql_pool_size ():
27
22
backend = MySQLBackend ("mysql://localhost/database?min_size=1&max_size=20" )
28
23
kwargs = backend ._get_connection_kwargs ()
29
- assert kwargs == {
30
- 'minsize' : 1 ,
31
- 'maxsize' : 20
32
- }
24
+ assert kwargs == {"minsize" : 1 , "maxsize" : 20 }
33
25
34
26
35
27
def test_mysql_ssl ():
36
28
backend = MySQLBackend ("postgres://localhost/database?ssl=true" )
37
29
kwargs = backend ._get_connection_kwargs ()
38
- assert kwargs == {
39
- 'ssl' : True ,
40
- }
30
+ assert kwargs == {"ssl" : True }
You can’t perform that action at this time.
0 commit comments