11import json
2- from multiprocessing import connection
32import os
4- import sqlite3
5- import tempfile
63import time
74
85import pytest
6+
97from sqlitecloud .client import SqliteCloudClient
108from sqlitecloud .types import (
119 SQCLOUD_ERRCODE ,
@@ -90,10 +88,10 @@ def test_is_connected(self):
9088 client = SqliteCloudClient (cloud_account = account )
9189
9290 conn = client .open_connection ()
93- assert client .is_connected (conn ) == True
91+ assert client .is_connected (conn )
9492
9593 client .disconnect (conn )
96- assert client .is_connected (conn ) == False
94+ assert not client .is_connected (conn )
9795
9896 def test_disconnect (self ):
9997 account = SqliteCloudAccount ()
@@ -104,10 +102,10 @@ def test_disconnect(self):
104102 client = SqliteCloudClient (cloud_account = account )
105103
106104 conn = client .open_connection ()
107- assert client .is_connected (conn ) == True
105+ assert client .is_connected (conn )
108106
109107 client .disconnect (conn )
110- assert client .is_connected (conn ) == False
108+ assert not client .is_connected (conn )
111109 assert conn .socket is None
112110 assert conn .pubsub_socket is None
113111
@@ -119,7 +117,7 @@ def test_select(self, sqlitecloud_connection):
119117
120118 result = client .exec_query ("SELECT 'Hello'" , connection )
121119
122- assert False == result .is_result
120+ assert not result .is_result
123121 assert 1 == result .nrows
124122 assert 1 == result .ncols
125123 assert "Hello" == result .get_value (0 , 0 )
@@ -239,7 +237,7 @@ def test_json(self, sqlitecloud_connection):
239237 connection , client = sqlitecloud_connection
240238 result = client .exec_query ("TEST JSON" , connection )
241239
242- assert SQCLOUD_RESULT_TYPE .RESULT_JSON == result .tag
240+ assert SQCLOUD_RESULT_TYPE .RESULT_JSON == result .tag
243241 assert {
244242 "msg-from" : {"class" : "soldier" , "name" : "Wixilav" },
245243 "msg-to" : {"class" : "supreme-commander" , "name" : "[Redacted]" },
@@ -293,7 +291,7 @@ def test_array(self, sqlitecloud_connection):
293291 result = client .exec_query ("TEST ARRAY" , connection )
294292
295293 result_array = result .get_result ()
296-
294+
297295 assert SQCLOUD_RESULT_TYPE .RESULT_ARRAY == result .tag
298296 assert isinstance (result_array , list )
299297 assert len (result_array ) == 5
@@ -332,7 +330,6 @@ def test_max_rows_option(self):
332330 # just expect everything is ok
333331 assert rowset .nrows > 100
334332
335-
336333 def test_max_rowset_option_to_fail_when_rowset_is_bigger (self ):
337334 account = SqliteCloudAccount ()
338335 account .hostname = os .getenv ("SQLITE_HOST" )
@@ -352,7 +349,6 @@ def test_max_rowset_option_to_fail_when_rowset_is_bigger(self):
352349 assert SQCLOUD_ERRCODE .INTERNAL .value == e .value .errcode
353350 assert "RowSet too big to be sent (limit set to 1024 bytes)." == e .value .errmsg
354351
355-
356352 def test_max_rowset_option_to_succeed_when_rowset_is_lighter (self ):
357353 account = SqliteCloudAccount ()
358354 account .hostname = os .getenv ("SQLITE_HOST" )
@@ -439,7 +435,7 @@ def test_query_timeout(self):
439435 LIMIT 10000000
440436 )
441437 SELECT i FROM r WHERE i = 1;""" ,
442- connection
438+ connection ,
443439 )
444440
445441 client .disconnect (connection )
@@ -645,7 +641,8 @@ def test_compression_multiple_columns(self):
645641
646642 # min compression size for rowset set by default to 20400 bytes
647643 rowset = client .exec_query (
648- "SELECT * from albums inner join albums a2 on albums.AlbumId = a2.AlbumId" , connection
644+ "SELECT * from albums inner join albums a2 on albums.AlbumId = a2.AlbumId" ,
645+ connection ,
649646 )
650647
651648 client .disconnect (connection )
0 commit comments